Partager via


CEdit::GetPasswordChar

Call this function to retrieve the password character that is displayed in an edit control when the user enters text.

TCHAR GetPasswordChar( ) const;

Return Value

Specifies the character to be displayed instead of the character that the user typed. The return value is NULL if no password character exists.

Remarks

If you create the edit control with the ES_PASSWORD style, the DLL that supports the control determines the default password character. The manifest or the InitCommonControlsEx method determines which DLL supports the edit control. If user32.dll supports the edit control, the default password character is ASTERISK ('*', U+002A). If comctl32.dll version 6 supports the edit control, the default character is BLACK CIRCLE ('●', U+25CF). For more information about which DLL and version supports the common controls, see Shell and Common Controls Versions.

This method sends the EM_GETPASSWORDCHAR message, which is described in the Windows SDK.

Example

// Turn on the password mode.
m_myEdit.SetPasswordChar('*');
ASSERT(m_myEdit.GetStyle() & ES_PASSWORD);
ASSERT(m_myEdit.GetPasswordChar() == '*');

Requirements

Header afxwin.h

See Also

Reference

CEdit Class

Hierarchy Chart

CEdit::SetPasswordChar

Shell and Common Controls Versions

InitCommonControlsEx

Other Resources

CEdit Members