Condividi tramite


CEdit::SetPasswordChar

Call this function to set or remove a password character displayed in an edit control when the user types text.

void SetPasswordChar(
   TCHAR ch 
);

Parameters

  • ch
    Specifies the character to be displayed in place of the character typed by the user. If ch is 0, the actual characters typed by the user are displayed.

Remarks

When a password character is set, that character is displayed for each character the user types.

This member function has no effect on a multiple-line edit control.

When the SetPasswordChar member function is called, CEdit will redraw all visible characters using the character specified by ch.

If the edit control is created with the ES_PASSWORD style, the default password character is set to an asterisk (*). This style is removed if SetPasswordChar is called with ch set to 0.

For more information, see EM_SETPASSWORDCHAR in the Windows SDK.

Example

// Turn off the password mode.
m_myEdit.SetPasswordChar(0);
ASSERT(!(m_myEdit.GetStyle() & ES_PASSWORD));

Requirements

Header: afxwin.h

See Also

Reference

CEdit Class

Hierarchy Chart

CEdit::GetPasswordChar

Other Resources

CEdit Members