Kannibale
10-17-2013, 04:02 PM
Okay this is what I have..
Public Shared Tibia As Process = Process.GetProcessesByName("Tibia")(0)
Private Declare Ansi Function SendMessage Lib "user32.dll" Alias "SendMessageA" (ByVal hwnd As IntPtr, ByVal wMsg As Integer, ByVal wParam As IntPtr, ByVal lParam As Integer) As IntPtr
Const WM_KEYDOWN = &H100
Const WM_KEYUP = &H101
Const GW_CHILD As Long = 5
Const WM_CHAR = 258
Const VK_F10 = &H79
Const VK_F5 = &H74
Const VK_L = &H4C
Const WM_SETTEXT = 12
Private Sub Button3_Click(sender As System.Object, e As System.EventArgs) Handles Button3.Click
SendMessage(Tibia.MainWindowHandle, WM_CHAR, VK_L, 0)
End Sub
It seems to work perfectly using WM_CHAR to send single characters to the client but if I try to use WM_KEYDOWN and then WM_KEYUP, nothing gets sent to the client..
SendMessage(Tibia.MainWindowHandle, WM_KEYDOWN, VK_L, 0)
SendMessage(Tibia.MainWindowHandle, WM_KEYUP, VK_L, 0)
^ Doesn't seem to work. Any thoughts why?
Public Shared Tibia As Process = Process.GetProcessesByName("Tibia")(0)
Private Declare Ansi Function SendMessage Lib "user32.dll" Alias "SendMessageA" (ByVal hwnd As IntPtr, ByVal wMsg As Integer, ByVal wParam As IntPtr, ByVal lParam As Integer) As IntPtr
Const WM_KEYDOWN = &H100
Const WM_KEYUP = &H101
Const GW_CHILD As Long = 5
Const WM_CHAR = 258
Const VK_F10 = &H79
Const VK_F5 = &H74
Const VK_L = &H4C
Const WM_SETTEXT = 12
Private Sub Button3_Click(sender As System.Object, e As System.EventArgs) Handles Button3.Click
SendMessage(Tibia.MainWindowHandle, WM_CHAR, VK_L, 0)
End Sub
It seems to work perfectly using WM_CHAR to send single characters to the client but if I try to use WM_KEYDOWN and then WM_KEYUP, nothing gets sent to the client..
SendMessage(Tibia.MainWindowHandle, WM_KEYDOWN, VK_L, 0)
SendMessage(Tibia.MainWindowHandle, WM_KEYUP, VK_L, 0)
^ Doesn't seem to work. Any thoughts why?