Applies a SFTMASK_CONTROL structure to the masked edit control, setting its attributes.
C
BOOL SftMask_SetControlInfo(HWND hwndCtl, LPSFTMASK_CONTROL lpCtl);C++
BOOL CSftMask::SetControlInfo(LPSFTMASK_CONTROL lpCtl);hwndCtl
The window handle of the masked edit control.
lpCtl
The address of a SFTMASK_CONTROL structure with the control's new attributes. The cbSize member must be set to sizeof(SFTMASK_CONTROL) before the call.
The return value is TRUE if the attributes were applied successfully. If a field is invalid, FALSE is returned and the read-only errorValue member of the structure identifies the offending field (see SFTMASK_ERR Constants); errorPos reports the position within the mask, if applicable.
All strings referenced by the structure are copied by the control; the application's buffers can be discarded after the call.
The edit mask can be changed together with other fields in the same SetControlInfo call: the control applies the other fields first, then the new mask. Changing lpszMask, fPadding, calCenturyBreak or calAdjust4DigitYear discards the control's contents.
Ctl.captioniVerticalAlignment = SFTMASK_VERTALIGNBASELINE;
Ctl.captionnSizePercent = 40;
Ctl.lpszLabel = (LPTSTR) TEXT("|"); // "|" displays the locale currency symbol
Ctl.lpszMask = (LPTSTR) TEXT("$C-,8.2");
Ctl.nCalcLines = 6;
Ctl.nFracDigits = 2;
Ctl.iClipMode = SFTMASK_CLIPEXCLUDE;
Ctl.nDarkMode = SFTMASK_DARKMODE_AUTO;
SftMask_SetControlInfo(hwndEdit, &Ctl);
}
/**********************************************************************/
/* Center the main dialog */
/**********************************************************************/
static void CenterWindow(HWND hwnd)
Ctl.captioniVerticalAlignment = SFTMASK_VERTALIGNBASELINE;
Ctl.captionnSizePercent = 40;
Ctl.lpszLabel = (LPTSTR) _T("|"); // "|" displays the locale currency symbol
Ctl.lpszMask = (LPTSTR) _T("$C-,8.2");
Ctl.nCalcLines = 6;
Ctl.nFracDigits = 2;
Ctl.iClipMode = SFTMASK_CLIPEXCLUDE;
Ctl.nDarkMode = SFTMASK_DARKMODE_AUTO;
m_Amount.SetControlInfo(&Ctl);
// Dark mode
SftDarkMode_ApplyToDialog(m_hWnd);
return TRUE;
}
See Also GetControlInfo | SFTMASK_CONTROL | SFTMASK_ERR Constants