Results 1 to 4 of 4

Thread: Forcing keystrokes for password entry

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2001
    Posts
    2
    Hello Everyone!

    I have a PDF file being opened in a OCX control in one of my forms, and it requires a password before it can be opened. However, I do not want the user to enter the password. Right now, I have my program set up to watch for the "Password" window, and then it sets the focus on it, and generates the password entry with simulated keystrokes. However, I would like to know if this is the best method. Part of the problem is that someone can run a key logger and get the password, and another problem is if a key is being held down while my program enters the password. Any ideas around any of these "problems" would be greatly appreciated. Thanks in advance!

    Jeremy Lounds

  2. #2
    Guest
    Try sending the WM_SETTEXT message rather than sending the actual keystrokes.
    Code:
    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 Const WM_SETTEXT = &HC
    
    Private Sub Command1_Click()
    
        SendMessage hwnd_of_window, WM_SETTEXT, 0, ByVal "MyPassword"
        
    End Sub

  3. #3

    Thread Starter
    New Member
    Join Date
    Feb 2001
    Posts
    2
    Hmmm... I must be doing something wrong, because when I tried that, it changed the actual caption of the window, and not the text entry field.

    Not something I want, that's for sure! :-)

    Jeremy

  4. #4
    Guest
    Change hwnd_of_window to the handle of the password entry box.

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