Keystrokes to Webpage

Posts 1–2 of 2 · Page 1 of 1
Keystrokes to Webpage
Hey.

I'm trying to create a bot which will automatically fill out forms on Google Chrome.

This is what I have so far:
Code:
Declare Auto Function FindWindow Lib "USER32.DLL" (ByVal lpClassName As String, ByVal lpWindowName As String) As IntPtr

Declare Auto Function SetForegroundWindow Lib "USER32.DLL" (ByVal hWnd As IntPtr) As Boolean 

Private Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles button1.Click

Dim webHandle As IntPtr = FindWindow("_______", "_______")

If webHandle = IntPtr.Zero Then
MsgBox("Webpage is not running.")
Return 
End If 

SetForegroundWindow(webHandle)
SendKeys.SendWait("Username")
SendKeys.SendWait("{TAB}")
SendKeys.SendWait("Password")
SendKeys.SendWait("{TAB}")
SendKeys.SendWait("Confirm Password")
SendKeys.SendWait("{TAB}")
'etc
End Sub
I have tested this code using numbers in other applications like Calculator by using CalcFrame and Calculator as the window class and name.

Code:
Dim webHandle As IntPtr = FindWindow("CalcFrame", "Calculator ")
However, every time I try to find the window class and window name for Google Chrome, it crashes.

Does anyone know a solution to the problem or can anyone tell me the window class and window name of Google Chrome?

Any help will be greatly appreciated.
Posts 1–2 of 2 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us