HeaderPane
Main
Hide

SftButton/DLL 3.0 - Button Control

Share Link
Print

RegisterApp

Register or unregister the SftButton/DLL window classes with the current process. RegisterApp must be called before any SftButton control is created; UnregisterApp must be called after all SftButton controls have been destroyed.

C

BOOL SftButton_RegisterApp(HINSTANCE hInstance);
void SftButton_UnregisterApp(HINSTANCE hInstance);

C++

static BOOL CSftButton::RegisterApp();
static void CSftButton::UnregisterApp();

Parameters

hInstance

The instance handle of the calling application (typically the hInstance passed to WinMain or obtained from AfxGetInstanceHandle in MFC). The C++ variants read the instance handle from MFC automatically.

Return Value

RegisterApp returns TRUE on success. UnregisterApp returns no value.

Comments

The typical call site for RegisterApp in a plain-Win32 application is immediately after the WinMain entry, before any dialog or window is created. In an MFC application, CSftButton::RegisterApp() goes in InitInstance and CSftButton::UnregisterApp() in ExitInstance.

Calling RegisterApp twice for the same process is a no-op. UnregisterApp is internally reference-counted against RegisterApp.

Examples

C

    g_hInst = hinst;

    icc.dwSize = sizeof(icc);
    icc.dwICC = ICC_WIN95_CLASSES;
    InitCommonControlsEx(&icc);

    // Register with SftButton/DLL
    SftButton_RegisterApp(hinst);

    // Initialize dark mode support
    SftDarkMode_Init();

    DialogBox(hinst, MAKEINTRESOURCE(IDD_MAIN), NULL, Main_DialogProc);

    // Unregister from SftButton/DLL
    SftButton_UnregisterApp(hinst);

C++

{
}

CSimpleApp NEAR theApp;

BOOL CSimpleApp::InitInstance()
{
    SftDarkMode_Init();                  // Dark mode support
    CSftButton::RegisterApp();           // Register with SftButton/DLL

    CMainDlg dlg;
    m_pMainWnd = &dlg;
    dlg.DoModal();

    return FALSE;
}

See Also C/C++ API | Using C | Using C++/MFC


Last Updated 05/09/2026 - (email)
© 2026 Softel vdm, Inc.