The EM_GETPASSWORDCHAR message identifies the password character used by an edit control. This characters appears in place of each character entered into the edit control, in order to hide its contents. As the name implies, this is typically done to hide a password entered into the control.
The message returns the ASCII value of the password character used by the edit control. If the control does not use a password character, the message returns 0.
None.
Const EM_GETPASSWORDCHAR = &HD2
Identify the password character used by edit control Text1 to hide its contents. To use this example, place a text edit box named Text1 and a command button named Command1 on a form window.
' This code is licensed according to the terms and conditions listed here.
' Declarations and such needed for the example:
' (Copy them to the (declarations) section of a module.)
Public Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" (ByVal hWnd _
As Long, ByVal Msg As Long, wParam As Any, lParam As Any) As Long
Public Const EM_GETPASSWORDCHAR = &HD2
' *** Place the following code inside the form window. ***
Private Sub Command1_Click()
Dim passchar As Long ' ASCII code of the password character
passchar = SendMessage(Text1.hWnd, EM_GETPASSWORDCHAR, ByVal CLng(0), ByVal CLng(0))
If passchar > 0 Then
Debug.Print "The password character is "; Chr(passchar)
Else
Debug.Print "Text1 does not use a password character."
End If
End Sub
Back to the Message list.
Back to the Reference section.
Last Modified: December 17, 2000
This page is copyright © 2000 Paul Kuliniewicz.
Copyright Information Revised October 29, 2000
Go back to the Windows API Guide home page.
E-mail: vbapi@vbapi.com Send Encrypted E-Mail
This page is at http://www.vbapi.com/ref/e/em_getpasswordchar.html