Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer


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

TCHAR GetPasswordChar( ) const;

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

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.

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

Header afxwin.h

© 2015 Microsoft