A preserved archive of the Logical Gamers community forums, 2009-2025. The original threads and posts, served read-only. Registration, posting and private messages are gone for good.

PostMessage API for VB.Net?

3.2k views · started by TEMPTii ·
#1
PostMessage API for VB.Net?
I've been searching for one but it seems as though it's nonexistent. Is it a built in function now?

I tried converting one from VB6 that stapled provided, but that can only go so far without error. If you have one could you send or any alternative?
#3
Doesn't have as much leeway as what I had hoped.

This is what I was kinda looking for...

stapled wrote:
I use vb6 but w/e

Declarations(I think this is all of them xD)
Private Declare Function FindWindowEx Lib "user32.dll" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String _
) As Long
Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, _
ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long

Private Type POINTAPI
X As Long
y As Long
End Type

Private Declare Function ClientToScreen Lib "user32" (ByVal hwnd As Long, lpPoint As POINTAPI) As Long
Private Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As Integer



The arrow movement:
Dim X As Integer
Dim hwnd As Long
Dim y As Integer
Dim blah As Long
Dim timeval As Long
Const WM_KEYDOWN = &H100
'gets the hwnd of the flash control used spy++
hwnd = FindWindowEx(Form1.hwnd, 0, "MacromediaFlashPlayerActiveX", vbNullString)
y = 0

Do
X = 0
Do
blah = PostMessage(hwnd, WM_KEYDOWN, vbKeyLeft, 0)
SecondsToWait (1)
X = X + 1
Loop Until X >= 10
X = 0
Do
blah = PostMessage(hwnd, WM_KEYDOWN, vbKeyRight, 0)
SecondsToWait (1)
X = X + 1
L = L + 1
Loop Until X >= 10

Loop Until L = 350