HeaderPane
Main
Hide
Share Link
Print

RegisterApp

Registers an application with SftDate/DLL.

C

BOOL WINAPI SftDate_RegisterApp(HINSTANCE hInst);

C++

static BOOL CSftDate::RegisterApp();
static BOOL CSftCalendar::RegisterApp();

Parameters

hInst

The instance handle of the application which will use SftDate/DLL controls. CSftDate::RegisterApp and CSftCalendar::RegisterApp use the instance handle of the MFC application (AfxGetInstanceHandle).

Returns

The return value is TRUE if SftDate/DLL has been initialized for this application, otherwise FALSE is returned.

Comments

The RegisterApp function registers an application with SftDate/DLL. It must be called before the first date field or month calendar control is created.

The SftDate/DLL DLL registers the window classes SFTDATE_CLASS and SFTCALENDAR_CLASS when it is loaded. When the static library is used (SFTDATE_STATIC), RegisterApp registers both window classes for the application instance passed to it.

A debug build of an application (_DEBUG or DEBUG defined) calls SftDate_RegisterAppD instead, because SftDate.h defines SftDate_RegisterApp as SftDate_RegisterAppD in that case. The application always uses the name SftDate_RegisterApp.

An application should call UnregisterApp once it no longer uses SftDate/DLL controls.

Examples

C View entire sample code

/*                              WinMain                               */
/**********************************************************************/

int PASCAL WinMain(HINSTANCE hinst, HINSTANCE hinstPrev, LPSTR lpszCmdLine, int cmdShow)
{
    g_hInst = hinst;

    SftDarkMode_Init();                 /* Dark mode support */
    SftDate_RegisterApp(hinst);         /* Register with SftDate/DLL */

    // A Unicode dialog, so the selected dates show in every culture's script, also in ANSI builds
    DialogBoxParamW(g_hInst, MAKEINTRESOURCEW(IDD_MAIN), NULL, MainDialogProc, 0);

    SftDate_UnregisterApp(hinst);       /* Unregister from SftDate/DLL */

    return 0;

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


Last Updated 11/26/2026 - (email)
© 2026 Softel vdm, Inc.