TranslateMessage without a control handle
Having a problem with TranslateMessage, I can't figure out how to use it to send it to a window that doesn't have controls (the option bars on the top) on it, like a game. The below stuff is used to send keys to Notepad, which of course does have controls on it. How do I make this work for a game?
Notice the second Dim, FindWindowEx. I want to get rid of that, as EverQuest II doesn't have an "Edit" control, or any control for that matter.
It's used like this:
Notice the "myMsg.hwnd = x" line. I tried changing that to "myMsg.hwnd = hwnd" and removing the "If x not 0" check but no dice.
Code:
Dim hwnd As Integer = FindWindow(vbNullString, findPartialTitle("EverQuest II").ToString) '/// assuming you have notepad open.
Dim x As Integer = FindWindowEx(hwnd, 0, "Edit", vbNullString)
It's used like this:
Code:
Public Structure MSG
Public hwnd As Integer
Public message As Integer
Public wParam As Integer
Public lParam As Integer
Public time As Integer
Public pt As Integer
End Structure
Dim myMsg As MSG = New MSG
If Not x = 0 Then
myMsg.hwnd = x
myMsg.message = WM_KEYDOWN
myMsg.wParam = key
myMsg.lParam = 0
Dim ret As Integer
ret = TranslateMessage(myMsg)
Debug.WriteLine("TranslateMessage " & ret.ToString)
End If
