HeaderPane
Main
Hide

SftMask/DLL 7.0 - Masked Edit Control

Share Link
Print

SetControlInfo

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);

Parameters

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.

Returns

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.

Comments

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 only be changed by itself - a SetControlInfo call that changes lpszMask must not change any other fields (see SFTMASK_ERR_MASKONLY). Changing the mask discards the control's contents.

Examples

C

    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);
}

/**********************************************************************/
/*                           Dialog Proc                              */
/**********************************************************************/

INT_PTR CALLBACK MainDialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)

C++

    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


Last Updated 08/30/2026 - (email)
© 2026 Softel vdm, Inc.