Results 1 to 3 of 3

Thread: How can I see if a textbox is masked

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2000
    Posts
    2

    Post

    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

  2. #2
    Addicted Member
    Join Date
    Oct 1999
    Posts
    253

    Post

    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.

  3. #3
    old fart Frans C's Avatar
    Join Date
    Oct 1999
    Location
    the Netherlands
    Posts
    2,926

    Post

    Try sending an EM_GETPASSWORDCHAR message to the textbox.
    Code:
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width