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 section describes how to use SftMask/DLL in an application written using the C programming language.
Please see "Building Applications" to prepare a project for development with SftMask/DLL.
| A) | Every source program making use of a SftMask/DLL control must include the required header file SftMask.h by using the #include directive. |
|---|
#include "SftMask.h" /* SftMask/DLL required header file */
This include statement should appear after the #include <windows.h> statement. The file is located in the directory \Program Files (x86)\Softelvdm\SftMask DLL 7.0\Include (unless changed during the installation). The project settings may need to be updated so the #include file can be located (see "Building Applications" for more information).
| B) | In order to use SftMask/DLL controls, an application must call the SftMask_RegisterApp function. The call to this function is required so that SftMask/DLL window classes can be registered. This call has to be made before any SftMask/DLL controls are created. Add the following statement to your source code, where your application registers its window classes (normally during application initialization): |
|---|
SftMask_RegisterApp(hInstance); /* Use SftMask/DLL with this application */| C) | Once SftMask/DLL controls are no longer needed, an application must call the SftMask_UnregisterApp function. The call to this function is required so that SftMask/DLL window classes can be unregistered and cleanup processing can take place. This call has to be made after all SftMask/DLL controls have been destroyed (normally during application termination). |
|---|
SftMask_UnregisterApp(hInstance); /* No longer use SftMask/DLL */| D) | The application's executable (Exe or Dll) must be linked with the correct Lib file, depending on the target environment. Please see "Building Applications" for more information. |
|---|
There are two methods to add a masked edit control to an application:
Adding a masked edit control using dialog resources is accomplished by using a resource editor to design a dialog. Once a masked edit control is created, its window handle can be obtained by using the Windows GetDlgItem function. For more information, see Creating a Dialog Resource.
Another method to create a masked edit control is by using the CreateWindow(Ex) Windows call:
hwndMask = CreateWindow(TEXT(SFTMASK_CLASS), NULL,
WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 10, 200, 24, hwndMain,
(HMENU) IDC_MASK, hInstance, NULL);For more information on the various parameters used, see the Windows API documentation.
A newly created masked edit control is configured using SftMask_SetControlInfo. Retrieve the current SFTMASK_CONTROL structure using SftMask_GetControlInfo, modify the desired fields (mask, caption, edit style, colors, behavior flags), then pass it back to SftMask_SetControlInfo.
SFTMASK_CONTROL Ctl; Ctl.cbSize = sizeof(SFTMASK_CONTROL); SftMask_GetControlInfo(hwndMask, &Ctl); Ctl.fAutoSize = TRUE; Ctl.lpszCaption = (LPTSTR) TEXT("&Phone:"); Ctl.lpszMask = (LPTSTR) TEXT("\\([M1-9]##\\) ###\\-####"); Ctl.nDarkMode = SFTMASK_DARKMODE_AUTO; SftMask_SetControlInfo(hwndMask, &Ctl);
As with standard Windows controls, applications must respond to events and messages to cause controls to respond to user requests. For additional information, see Notifications.
Respond to the WM_COMMAND / SFTMASKN_CHANGE notification just as you would for a standard Windows edit control's EN_CHANGE:
case WM_COMMAND: { int id = LOWORD(wParam); int code = HIWORD(wParam); switch (id) { case IDC_MASK: if (code == SFTMASKN_CHANGE) ContentsChanged(); break; } break; }
Extended notifications, such as validation errors or autocomplete matching, are delivered as WM_NOTIFY messages with NM_SFTMASK_* structures. See Notifications for the complete list.
