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 several common data entry controls hosted in an MFC dialog through CSftMask and DDX_Control: IP address input with up-down buttons and auto advance, password input with a hidden display character, a US phone number mask, and a path field with file/folder autocomplete where the ellipse button opens the suggestion dropdown (SFTMASKN_ELLIPSECLICKED handled with ON_CONTROL).
The source code is located at C:\Program Files (x86)\Softelvdm\SftMask DLL 7.0\Samples\MFC\DataEntry or C:\Program Files\Softelvdm\SftMask DLL 7.0\Samples\MFC\DataEntry (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 "stdafx.h" #include "MainDlg.h" #ifdef _DEBUG #undef THIS_FILE static char BASED_CODE THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CMainDlg dialog BEGIN_MESSAGE_MAP(CMainDlg, CDialog) ON_CONTROL(SFTMASKN_ELLIPSECLICKED, IDC_PATH, OnPathEllipse) END_MESSAGE_MAP() CMainDlg::CMainDlg(CWnd* pParent) : CDialog(CMainDlg::IDD, pParent) { m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); } void CMainDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); DDX_Control(pDX, IDC_IPADDRESS, m_IPAddress); DDX_Control(pDX, IDC_PASSWORD, m_Password); DDX_Control(pDX, IDC_PHONE, m_Phone); DDX_Control(pDX, IDC_PATH, m_Path); } BOOL CMainDlg::OnInitDialog() { CDialog::OnInitDialog(); SetIcon(m_hIcon, TRUE); // Set big icon SetIcon(m_hIcon, FALSE); // Set small icon // IP address with up-down buttons { SFTMASK_CONTROL Ctl; Ctl.cbSize = sizeof(SFTMASK_CONTROL); m_IPAddress.GetControlInfo(&Ctl); Ctl.fAutoSize = TRUE; Ctl.iAlignment = ES_LEFT; Ctl.iBorderStyle = SFTMASK_BORDER_THIN; Ctl.iEditStyle = SFTMASK_EDITUPDOWN; Ctl.fAutoAdvance = TRUE; Ctl.fTabAdvance = TRUE; Ctl.fPromptUnderline = TRUE; Ctl.lpszCaption = (LPTSTR) _T("&IP Address:"); Ctl.captionfTransparent = TRUE; Ctl.captioniPosition = SFTMASK_POSITIONLEFT; Ctl.captioniAlignment = ES_LEFT; Ctl.captioniVerticalAlignment = SFTMASK_VERTALIGNBASELINE; Ctl.captionnSizePercent = 40; Ctl.lpszMask = (LPTSTR) _T("$I^03(0,255)\\.$I^03(0,255)\\.$I^03(0,255)\\.$I^03(0,255)"); Ctl.nDarkMode = SFTMASK_DARKMODE_AUTO; m_IPAddress.SetControlInfo(&Ctl); } // Password input (hidden characters) { SFTMASK_CONTROL Ctl; Ctl.cbSize = sizeof(SFTMASK_CONTROL); m_Password.GetControlInfo(&Ctl); Ctl.fAutoSize = TRUE; Ctl.iAlignment = ES_LEFT; Ctl.iBorderStyle = SFTMASK_BORDER_THIN; Ctl.chPswdChar = _T('*'); Ctl.nMaxLength = 16; Ctl.lpszCaption = (LPTSTR) _T("&Password:"); Ctl.captionfTransparent = TRUE; Ctl.captioniPosition = SFTMASK_POSITIONLEFT; Ctl.captioniAlignment = ES_LEFT; Ctl.captioniVerticalAlignment = SFTMASK_VERTALIGNBASELINE; Ctl.captionnSizePercent = 40; Ctl.lpszMask = (LPTSTR) _T(""); Ctl.nDarkMode = SFTMASK_DARKMODE_AUTO; m_Password.SetControlInfo(&Ctl); } // US phone number { SFTMASK_CONTROL Ctl; Ctl.cbSize = sizeof(SFTMASK_CONTROL); m_Phone.GetControlInfo(&Ctl); Ctl.fAutoSize = TRUE; Ctl.iAlignment = ES_LEFT; Ctl.iBorderStyle = SFTMASK_BORDER_THIN; Ctl.fPromptUnderline = TRUE; Ctl.lpszCaption = (LPTSTR) _T("P&hone:"); Ctl.captionfTransparent = TRUE; Ctl.captioniPosition = SFTMASK_POSITIONLEFT; Ctl.captioniAlignment = ES_LEFT; Ctl.captioniVerticalAlignment = SFTMASK_VERTALIGNBASELINE; Ctl.captionnSizePercent = 40; Ctl.lpszMask = (LPTSTR) _T("\\([M1-9]##\\) ###\\-####"); Ctl.nDarkMode = SFTMASK_DARKMODE_AUTO; m_Phone.SetControlInfo(&Ctl); } // Path with file/folder autocomplete { SFTMASK_CONTROL Ctl; Ctl.cbSize = sizeof(SFTMASK_CONTROL); m_Path.GetControlInfo(&Ctl); Ctl.fAutoSize = TRUE; Ctl.iAlignment = ES_LEFT; Ctl.iBorderStyle = SFTMASK_BORDER_THIN; Ctl.iEditStyle = SFTMASK_EDITELLIPSE; Ctl.nMaxLength = 300; Ctl.lpszCaption = (LPTSTR) _T("Pa&th:"); Ctl.captionfTransparent = TRUE; Ctl.captioniPosition = SFTMASK_POSITIONLEFT; Ctl.captioniAlignment = ES_LEFT; Ctl.captioniVerticalAlignment = SFTMASK_VERTALIGNBASELINE; Ctl.captionnSizePercent = 20; Ctl.lpszMask = (LPTSTR) _T(""); Ctl.auto_iMode = SFTMASK_AUTOCOMPLETE_SUGGESTAPPEND; Ctl.auto_iContents = SFTMASK_AUTOCOMPLETECONTENTS_FILESDIRS; Ctl.auto_fOptimalHeight = TRUE; Ctl.nDarkMode = SFTMASK_DARKMODE_AUTO; m_Path.SetControlInfo(&Ctl); } // Dark mode SftDarkMode_ApplyToDialog(m_hWnd); return TRUE; } void CMainDlg::OnPathEllipse() { m_Path.AutoCompleteRefresh(); // open the suggestion dropdown } void CMainDlg::OnOK() { // Enter must not close the sample }
