Click here to Skip to main content
15,896,349 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am having a Edit control and I want to change it to password type. How I can do it programmatically ?
I am using Visual C++ (MFC application)

What I have tried:

Code I have used
C++
CEdit* pEdit = ( CEdit* ) GetDlgItem( IDC_.... );
pEdit->ModifyStyle( 0, ES_PASSWORD );


But this code is not working.
Posted
Updated 8-Jun-16 21:36pm

 
Share this answer
 
Comments
Member 10641779 9-Jun-16 6:55am    
Thanks for the Nice solution.
CPallini 9-Jun-16 8:09am    
You are welcome.
 
Share this answer
 
Comments
Member 10641779 9-Jun-16 6:58am    
This one I checked earlier, this is converting password text into normal text. where as I need text to password.
Richard MacCutchan 9-Jun-16 7:30am    
Then you must be doing it wrong.
Member 10641779 10-Jun-16 5:17am    
GetDlgItem(IDC_...)->SendMessage(EM_SETPASSWORDCHAR, 0, 0);
this will change password to text.
Can you plz write down code to convert text to password?
Richard MacCutchan 10-Jun-16 5:20am    
Go back to the link I gave you and study the details.
Member 10641779 10-Jun-16 7:18am    
Thanks, I got this worked.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900