klussier
asked on
Dynamically changing an edit control to/from password mode
How can I dynamically change an edit control in my dialog box to and from password mode (ES_PASSWORD style set)? At first glance it seems easy, use ModifyStyle. But that does not work. Nor does using GetWindowLong and SetWindowLong. The style gets set, but the edit control remains unchanged (ie does not display as a password if the ES_PASSWORD style was not set at creation).
Kevin Lussier
klussier@redcreek.com
Kevin Lussier
klussier@redcreek.com
Certain styles cannot be changed dynamically. In this case, you will have to create two controls, one that is a password and the other not. Then you can switch between them by making sure the text in both is the same and hiding one and showing the other (ShowWindow(WS_VISIBLE)).
I think whenever you want to have a input in password form, Call SetPasswordChar('*') function of CEdit class and when you want it in normal mode call SetPasswordchar() function without any paramemter or with zero. So it will show all input as it is entered.
thui's answer would work, but isn't a good solution. dipesh's answer is the way to go--you should ask him to resubmit it so you can give him the points he deserves.
.B ekiM
.B ekiM
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.