I am trying to work with the API Sendmessage, and its possible messages. My little project is to change
my hotmail account name in the textbox of the hotmail sign in page.( I know of allapi, and I have a spying program
to look at childs of windows,etc.
So far I have this, but it is not having any effect. I suspose from reading other threads I need to find a handle to the
particular textbox to add data.
I am using VB.NET
VB Code:
Public Class Form1 Private Declare Function FindWindow Lib "user32.dll" Alias "FindWindowA" ( ByVal lpClassName As String,ByVal lpWindowName As String) As Int32 Private Declare Function GetWindow Lib "user32.dll" (ByVal hwnd As Int32, ByVal wCmd As Int32) As Int32 Private Declare Function FindWindowEx Lib "user32.dll" Alias "FindWindowExA" (ByVal hWnd1 As Int32, ByVal hWnd2 As Int32, ByVal lpsz1 As String, ByVal lpsz2 As String) As Int32 Private Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" (ByVal hwnd As Int32, ByVal wMsg As Int32, ByVal wParam As Int32, ByVal lParam As Int32) As Int32 Private Const WM_LBUTTONDOWN As Int32 = &H201 Private Const GW_CHILD As Int32 = 5 Private Const WM_SETTEXT As Int32 = &HC Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim title As String = "Sign In - Microsoft Internet Explorer" Dim winclass As String = "IEFrame" 'login page Dim winchildclass As String = "Internet Explorer_Server" 'found by spying on login page of hotmail seems to be the child Dim handlemain As Int32 handlemain = FindWindow(winclass, title) Dim hwndtextbox As Int32 hwndtextbox = FindWindow(winchildclass, vbNullString) Dim han As Int32 ' hwndtextbox = FindWindowEx(handlemain, 0&, [TextboxClassName], vbNullString) ' dog = GetWindow(handlemain, GW_CHILD) Dim cat As String = "hello there" SendMessage(han, WM_SETTEXT, Len(cat), cat) End Sub End Class




Reply With Quote