Introduction
This code shows you how to dynamically change the edit control style specifically for the password feature..
Background
Being familiar with the CEdit
class would be useful.
Using the Code
I had a need to change the password style on an edit control dynamically. The following code shows how this can be done:
m_CtrlEditData.SetPasswordChar('*');
m_CtrlEditData.Invalidate();
m_CtrlEditData.SetPasswordChar(0);
m_CtrlEditData.Invalidate();
Points of Interest
The call to Invalidate()
was necessary, otherwise you may simply not see any change.
SetPasswordChar
with a 0
, not a '0'
to show user input. In other words, SetPasswordChar('0')
does not work, but SetPasswordChar(0)
does work.
History