Click to See Complete Forum and Search --> : How can I see if a textbox is masked
Thomas Nielsen
Jan 12th, 2000, 02:27 AM
HI
I have he textbox's hWnd, ad now i want to check if it's masked out (text written with stars)
Does anyoneknow how I can do this?
thnx
Thomas
Forest Dragon
Jan 13th, 2000, 08:19 PM
Check the PasswordChar property of the textbox. If it has any value other than "", then every key you press when the textbox has the focus, will be shown as the character that is the value of the PasswordChar property.
Frans C
Jan 14th, 2000, 02:14 AM
Try sending an EM_GETPASSWORDCHAR message to the textbox.
Option Explicit
Private Const EM_GETPASSWORDCHAR = &HD2
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Sub Command1_Click()
Dim retVal As Long
retVal = SendMessage(Text1.hwnd, EM_GETPASSWORDCHAR, 0&, 0&)
If retVal <> 0 Then
MsgBox "Password Character = " & Chr(retVal)
Else
MsgBox "No Password Character"
End If
End Sub
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.