How to hide password

This is a discussion on How to hide password within the Windows Programming forums, part of the Platform Specific Boards category; Hello!
I'm begginer to MFC so don't mind if I ask stupid question.
This is my problem:
I'm writting this ...

How to hide password

Hello!

I'm begginer to MFC so don't mind if I ask stupid question.
This is my problem:
I'm writting this program where you have to write password into a dialog resources before you go to next level of program.
Is anybody know how to hide password t ex **** should be showed when you fil in password.

Anythings possible lol, its pretty simple to make an edit contol have password view thingi. I do not know much MFC but in the API when you create your edit box, you add ES_PASSWORD style, dunno if you use this in MFC though, also if your using a dialog right click on ur edit box, and go to properties and tick the password style.

If you want to get low-level with putting the '*' in the edit box instead of the char, you can intercept the EN_CHANGE (I believe this is the message before the edit puts the char into the edit box and EN_UPDATE is after it is put in) and append the char onto a string and then just put in a '*' into the edit box. Although, I'm not sure, even if you intercept this message, that it won't put the normal char in anyway. For instance, if you use this logic, you might get output like T*e*s*t*...so you just use ES_PASSWORD as the style of window.

Re: EN_CHANGE to change the char to *

Originally posted by zMan I did it that way the last time and it was more trouble than it was worth... because I had a hardtime position the caret in the proper location...

also the call is recursive because SetWindowText(...) will also send another EN_CHANGE....
it is somewhat of a bad dream to do it that way....

Yes, that makes sense. You should've done tested the ascii value to see if it was "*" first and if it was then that would end the recursion (because after the change it would override that option, Understand?). So, that would work out. But, you are right, just use ES_PASSWORD style. It would be easy if we were designing the control from the start to enable this and it would make it simple. So, don't think it's a short-cut, just use that constant...