Page 1 of 1
TextBox with DefaultPasswordChar
Posted: 08 Nov 2010, 13:55
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
Re: TextBox with DefaultPasswordChar
Posted: 08 Nov 2010, 14:51
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.
Re: TextBox with DefaultPasswordChar
Posted: 09 Nov 2010, 11:21
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
Re: TextBox with DefaultPasswordChar
Posted: 09 Nov 2010, 22:26
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.
Re: TextBox with DefaultPasswordChar
Posted: 10 Nov 2010, 08:27
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.