Hide

SftTabs/DLL 6.5 - Tab Control

Display
Print

CopyWindowTitle

Copies the window caption of a window to another window.

C

void WINAPI SftTabs_CopyWindowTitle(HWND hwndFrom, HWND hwndTo);

Parameters

hwndFrom

The window handle of the window whose caption is to be copied to hwndTo.

hwndTo

The window handle of the window which is to receive the window caption copied from hwndFrom.

Comments

The CopyWindowTitle function copies the window caption of a window to another window.

SftTabs_CopyWindowTitle is typically used in a SFTTABS_TABCALLBACK function to copy a page's caption to the enclosing dialog.

If the window caption described by hwndFrom is an empty string, the caption of the window described by hwndTo is not changed.

Example

C

HWND CALLBACK Page1_Callback(BOOL fCreate, HWND hwndOwner, HWND hwndPage, HWND hwndTab)
{
    if (fCreate) { // creating a new page
        if (hwndPage) {
            // already created, we could do some initialization here.
            // this will be called every time the page becomes active.
            // The WM_SHOWWINDOW message is also sent to the page and could
            // be used to determine activation/deactivation of the page.

            // optional, set the main window's title to the window title defined for this page
            SftTabs_CopyWindowTitle(hwndPage, hwndOwner);
            return NULL; // return NULL, ignored
        } else {
            // Create the page.
            // You can create and initialize any type of window here, not just dialogs.
            // Use CreateWindow to create other windows. Don't specify WS_VISIBLE, but
            // make sure you use WS_TABSTOP.
            // When creating a non-dialog window, make sure to call SftTabs_SetPageActive
            // after the page has been created.
            HWND hwnd = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_PAGE1), hwndOwner, (DLGPROC)Page1_DialogProc,
                (LPARAM)hwndTab);// pass tab control as data
            // optional, set the main window's title to the window title defined for this page
            SftTabs_CopyWindowTitle(hwnd, hwndOwner);
            return hwnd;
        }
    } else { // destroying page
        if (hwndOwner) // - because we're switching away
            return hwndPage; // keep the window handle, don't destroy it
        else { // - because we're closing the main dialog
            DestroyWindow(hwndPage);
            return NULL;
        }
    }
}

Examples

C

    if (fCreate) {                      // creating a new page
        if (hwndPage) {
            // already created, we could do some initialization here.
            // this will be called every time the page becomes active.
            // The WM_SHOWWINDOW message is also sent to the page and could
            // be used to determine activation/deactivation of the page.

            // optional, set the main window's title to the window title defined for this page
            SftTabs_CopyWindowTitle(hwndPage, hwndOwner);
            return NULL;                // return NULL, ignored
        } else {
            // Create the page.
            // You can create and initialize any type of window here, not just dialogs.
            // Use CreateWindow to create other windows. Don't specify WS_VISIBLE, but
            // make sure you use WS_TABSTOP.
            // When creating a non-dialog window, make sure to call SftTabs_SetPageActive

See Also C/C++ API | C++ Classes | Notifications


Last Updated 08/13/2020 - (email)
© 2024 Softel vdm, Inc.