SftButton/DLL 3.0 - Button Control
SftTree/DLL 8.0 - Tree Control
SftBox/OCX 5.0 - Combo Box Control
SftButton/OCX 4.0 - Button Control
SftMask/OCX 7.0 - Masked Edit Control
SftTabs/OCX 6.5 - Tab Control (VB6 only)
SftTree/OCX 8.0 - Tree Control
SftButton/DLL 3.0 - Button Control
SftTree/DLL 8.0 - Tree Control
SftBox/OCX 5.0 - Combo Box Control
SftButton/OCX 4.0 - Button Control
SftMask/OCX 7.0 - Masked Edit Control
SftTabs/OCX 6.5 - Tab Control (VB6 only)
SftTree/OCX 8.0 - Tree Control
SftTree/NET 2.0 - Tree Control
This sample illustrates date input with a dropdown calendar (defaulting to today's date using the =Today default text) and date/time input with up-down buttons and tabbing between fields.
The source code is located at C:\Program Files (x86)\Softelvdm\SftMask DLL 7.0\Samples\C\DateTime\DateTime.c or C:\Program Files\Softelvdm\SftMask DLL 7.0\Samples\C\DateTime\DateTime.c (on 32-bit Windows versions).
/****************************************************************************/ /* SftMask/DLL 7.0 - Masked Edit Control for C/C++ */ /* Copyright (C) 2026 Softel vdm, Inc. All Rights Reserved. */ /****************************************************************************/ /* SftMask/DLL 7.0 sample. API reference: SftMask-DLL-7.0.txt (in the installation root) or https://softelvdm.com/Vault/Softelvdm.com/llms/SftMask-DLL-7.0.txt - see AGENTS.md. */ #include <windows.h> #include "SftMask.h" /* SftMask/DLL Header File */ #define SFTDARKMODE_IMPLEMENTATION #include "SftDarkMode.h" /* Dark mode support */ #include "resource.h" // application resources HINSTANCE g_hInst; // App Instance Handle /**********************************************************************/ /* Date and Date/Time Input */ /**********************************************************************/ static void InitDate(HWND hwndDlg) { HWND hwndEdit = GetDlgItem(hwndDlg, IDC_DATE); SFTMASK_CONTROL Ctl; Ctl.cbSize = sizeof(SFTMASK_CONTROL); SftMask_GetControlInfo(hwndEdit, &Ctl); Ctl.fAutoSize = TRUE; Ctl.iAlignment = ES_LEFT; Ctl.iBorderStyle = SFTMASK_BORDER_THIN; Ctl.iEditStyle = SFTMASK_EDITCALENDARDROPDOWN; Ctl.fDDButtonCalendar = TRUE; Ctl.calfDropOnFocus = FALSE; Ctl.lpszCaption = (LPTSTR) TEXT("&Date:"); Ctl.captionfTransparent = TRUE; Ctl.captioniPosition = SFTMASK_POSITIONLEFT; Ctl.captioniAlignment = ES_LEFT; Ctl.captioniVerticalAlignment = SFTMASK_VERTALIGNBASELINE; Ctl.captionnSizePercent = 40; Ctl.lpszMask = (LPTSTR) TEXT("$D"); Ctl.lpszDefaultText = (LPTSTR) TEXT("=Today"); Ctl.iDefaultStyle = SFTMASK_DEFAULT_IMMEDIATE; Ctl.nDarkMode = SFTMASK_DARKMODE_AUTO; SftMask_SetControlInfo(hwndEdit, &Ctl); } static void InitDateTime(HWND hwndDlg) { HWND hwndEdit = GetDlgItem(hwndDlg, IDC_DATETIME); SFTMASK_CONTROL Ctl; Ctl.cbSize = sizeof(SFTMASK_CONTROL); SftMask_GetControlInfo(hwndEdit, &Ctl); Ctl.fAutoSize = TRUE; Ctl.iAlignment = ES_LEFT; Ctl.iBorderStyle = SFTMASK_BORDER_THIN; Ctl.iEditStyle = SFTMASK_EDITUPDOWN; Ctl.fTabAdvance = TRUE; Ctl.lpszCaption = (LPTSTR) TEXT("Date/&Time:"); Ctl.captionfTransparent = TRUE; Ctl.captioniPosition = SFTMASK_POSITIONLEFT; Ctl.captioniAlignment = ES_LEFT; Ctl.captioniVerticalAlignment = SFTMASK_VERTALIGNBASELINE; Ctl.captionnSizePercent = 40; Ctl.lpszMask = (LPTSTR) TEXT("$D $T"); Ctl.nDarkMode = SFTMASK_DARKMODE_AUTO; SftMask_SetControlInfo(hwndEdit, &Ctl); } /**********************************************************************/ /* Dialog Proc */ /**********************************************************************/ INT_PTR CALLBACK MainDialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) { case WM_INITDIALOG: SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)LoadIcon(g_hInst, MAKEINTRESOURCE(IDI_APP))); InitDate(hwndDlg); InitDateTime(hwndDlg); SftDarkMode_ApplyToDialog(hwndDlg); return TRUE; case WM_COMMAND: switch (LOWORD(wParam)) { case IDCANCEL: EndDialog(hwndDlg, 0); return TRUE; } break; } { INT_PTR dmResult; if (SftDarkMode_HandleDialogMessage(hwndDlg, msg, wParam, lParam, &dmResult)) return dmResult; } return FALSE; } /**********************************************************************/ /* WinMain */ /**********************************************************************/ int PASCAL WinMain(HINSTANCE hinst, HINSTANCE hinstPrev, LPSTR lpszCmdLine, int cmdShow) { g_hInst = hinst; SftDarkMode_Init(); /* Dark mode support */ SftMask_RegisterApp(hinst); /* Register with SftMask/DLL */ DialogBox(g_hInst, MAKEINTRESOURCE(IDD_MAIN), NULL, MainDialogProc); SftMask_UnregisterApp(hinst); /* Unregister from SftMask/DLL */ return 0; }
