Everything lol.
It works when i test it with notepad, but it doesnt work with zOMG!Code:Declare Function GetWindow Lib "user32.dll" (ByVal hWnd As IntPtr, ByVal uCmd As Integer) As IntPtr Declare Function FindWindow Lib "user32.dll" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As IntPtr 'Int32 Declare Function SendMessageHM Lib "user32.dll" Alias "SendMessageA" ( _ ByVal hWnd As IntPtr, _ ByVal wMsg As Int32, _ ByVal wParam As Int32, _ ByVal lParam As String) As Int32 Const WM_SETTEXT As Long = &HC Const GW_CHILD As Long = 5 Dim hWnd1 As IntPtr = FindWindow("zOMG", Window) Dim hWndR2 As IntPtr = GetWindow(hWnd1, GW_CHILD) SendMessageHM(hWndR2, WM_SETTEXT, 0, TextBox1.Text)
EDIT:
i changed it to this code:
And it changed the name of the window ><Code:Declare Function GetWindow Lib "user32.dll" (ByVal hWnd As IntPtr, ByVal uCmd As Integer) As IntPtr Declare Function FindWindow Lib "user32.dll" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Int32 Declare Function SendMessageHM Lib "user32.dll" Alias "SendMessageA" ( _ ByVal hWnd As Int32, _ ByVal wMsg As Int32, _ ByVal wParam As Int32, _ ByVal lParam As String) As Int32 Const WM_SETTEXT As Long = &HC Const GW_CHILD As Long = 5 Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click Dim hWnd1 As Int32 = FindWindow(vbNullString, Window) SendMessageHM(hWnd1, WM_SETTEXT, 0, "k")
Results 1 to 10 of 10
Thread: VB.NET SendMessage
Hybrid View
- 14 Apr. 2013 04:43pm #1
Last edited by Kitsune; 14 Apr. 2013 at 05:00pm.
There's nothing ideal about being real, there's so many flaws to cover and conceal.
- 14 Apr. 2013 05:57pm #2
You should probably be using something like SendKeys instead of the SendMessage API.
SendMessage is a Win32 function intended for sending messages to windows (like closing) rather than simulating raw key strokes.
Plenty of other ways of going about something that sends keys to a window if SendMessage isn't working for you. :p