TextBox with DefaultPasswordChar

The place for threads about TimoSoft EditControls.
Post Reply
akris
Cadet
Posts: 3
Joined: 08 Nov 2010, 13:49
Location: Berlin

TextBox with DefaultPasswordChar

Post by akris »

Hi,
thanks for your great controls. I really love them!
Is there a way without changing the TextBox's font to use the systems PasswordChar (black bullet) in the TextBox control instead of using the * as PasswordChar?
Thanks,
akris
User avatar
TiKu
Administrator
Administrator
Posts: 832
Joined: 28 Sep 2004, 21:10
Location: München
Contact:

Re: TextBox with DefaultPasswordChar

Post by TiKu »

By default, the control uses the system's default password char. But you must take into account, that the system's default password char depends on the version of comctl32.dll (note: DLL, not OCX) that you are using in your program. If your app doesn't use Windows themes (read: has no manifest which makes it use version 6.0 of comctl32.dll), it uses the asterisk as password char. If your app uses Windows themes, it uses the bullet as password char.
Feel free to compare this behavior with a plain edit control which has been created with CreateWindowEx. Only set the ES_PASSWORD style, without sending the EM_SETPASSWORDCHAR message. You will get the exact same behavior as with my TextBox control.

You could use EM_SETPASSWORDCHAR to set the bullet char even if you do not use Windows themes. But this wouldn't be consistent with system settings anymore.
Crunching for Fab36_Folding-Division at Folding@Home. Join Fab36/Fab30! - Folding@Home and BOINC
Boycott DRM! Boycott HDCP!
akris
Cadet
Posts: 3
Joined: 08 Nov 2010, 13:49
Location: Berlin

Re: TextBox with DefaultPasswordChar

Post by akris »

Thank you for your immediate answer!
My program uses a manifest which makes it using version 6 of comctl32.dll, but continues displaying the * instead of the bullet.
I tried it using the default TextBox control from the VB6 toolbox and I tried it again using the ANSI version of your TextBox control. The result is the same: No bullet as PasswordChar.
Is there a way to send the ES_PASSWORD style after the TextBox was created?
akris
User avatar
TiKu
Administrator
Administrator
Posts: 832
Joined: 28 Sep 2004, 21:10
Location: München
Contact:

Re: TextBox with DefaultPasswordChar

Post by TiKu »

Ah, you use the ANSI edition. Well, the black bullet is an Unicode character. Therefore you won't get it with the ANSI edition.

Why are you using the ANSI edition? The Unicode edition has better performance, because VB6 and Windows work with Unicode strings, so no conversion is necessary. And it supports, well, Unicode. I see no reason why anyone should still use the ANSI edition and if building it would require me more than setting a compiler switch, I would have abandoned it already.
Crunching for Fab36_Folding-Division at Folding@Home. Join Fab36/Fab30! - Folding@Home and BOINC
Boycott DRM! Boycott HDCP!
akris
Cadet
Posts: 3
Joined: 08 Nov 2010, 13:49
Location: Berlin

Re: TextBox with DefaultPasswordChar

Post by akris »

This solved the problem. Thanks!
There was no special reason why I used the ANSI editions. I just thought that there is no need for any Unicode characters in my programs. But I was wrong ;)
Thanks again.
Post Reply