I'm trying to use the send message function with Internet Explorer to fill in a form for me automatically. Basically, I want to auto login to my credit card account.
What I have so far. I substituted the standard VK_TAB for it's equivalent. But for some reason this code is not sending any tabs to the browser window. There are no error messages popping up though. Right now I'm at a loss and don't want to use SendKeys since it too does not work very well.
VB 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
Function Decide()
Select Case varBank
Case "Merrill":
window1 = FindWindow(vbNullString, "Merrill Lynch Credit Card Access: Log In - Microsoft Internet Explorer")
SendMessage window1, &H100, &H9, 0&
SendMessage window1, &H101, &H9, 0&
SendMessage window1, &H100, &H9, 0&
SendMessage window1, &H101, &H9, 0&
SendMessage window1, &H100, &H9, 0&
SendMessage window1, &H101, &H9, 0&
End Select
End Function
Can anyone figure this out for me or write me a short snippet that will work?
VB.NET 2005 Express with .Net 2.0
C# 2010 .Net 4.0
I'd try this, send the commands to the web page view instead of IE. Using spy++ i found that the class of IE is: "IEFrame". But it has the page view component, class name "Shell DocObject View" with no caption, then from that it has a class, "Internet Explorer_Server".
Pseudo Code:
*Get Desktop Handle using FindWindow
*Get IE Handle using FindWindowEx (class name "IEFrame")
*Get IE Handle component using FindWindowEx (class name "Shell DocObject View")
*Get IE Handle sub componentusing FindWindowEx (class name "Internet Explorer_Server")
*Then send a message to that last handle, and see if it works.
Please let me know, I'll try this later and see if it'll work, I'll use VBForums as my guiene pig
Good programming site:
*http://www.planet-source-code.com
Originally posted by Insane_Magician I'd try this, send the commands to the web page view instead of IE. Using spy++ i found that the class of IE is: "IEFrame". But it has the page view component, class name "Shell DocObject View" with no caption, then from that it has a class, "Internet Explorer_Server".
Pseudo Code:
*Get Desktop Handle using FindWindow
*Get IE Handle using FindWindowEx (class name "IEFrame")
*Get IE Handle component using FindWindowEx (class name "Shell DocObject View")
*Get IE Handle sub componentusing FindWindowEx (class name "Internet Explorer_Server")
*Then send a message to that last handle, and see if it works.
Please let me know, I'll try this later and see if it'll work, I'll use VBForums as my guiene pig
Unfortunately, that's way over my head. If you get it working post some code up if you would, I'd probably understand it then.
VB.NET 2005 Express with .Net 2.0
C# 2010 .Net 4.0
Sorry I didn't make it clear..
See above code again I modified it.
And the hWnd variable for SendMessage\PostMessage = lhwnd ,
after calling FindWindowLike(0, sParentText, sClassToFind)
i retract my last post sorry i spoke too soon
dglienna code helped until i relized it used sendkeys which i cant cause send keys needs program to be active window
$hep this is what i have and it doesnt seem to work
i use spy++ to see the messages being passed and no luck
VB Code:
Dim sParentText As String, sClassToFind As String
' Set parent caption to find
sParentText = "Vernier Secure Logon - Microsoft Internet Explorer"
and i need to submit the second form on the page
i tried changing the value to 1 but that iddnt work i tried changing it to the name of the form but no luck either