1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Using PostMessage in VB.NET [Help me please.]

Discussion in 'Programming' started by Lollage, Aug 25, 2010.

  1. Lollage

    Lollage Well-Known Member

    Hi there,
    I'm making something using VB.NET, and I want to make my character move left/right and let it attack for a few times..
    I'm told that using PostMessage() was the most simple way, or Sendkeys.Send(''{LEFT}'') but I seem to get an error at both.

    I already have it declared it like this

    Code (Text):
    1.     Private Declare Function PostMessage Lib "user32" _
    2.        Alias "PostMessageA" _
    3.       (ByVal hwnd As Long, _
    4.        ByVal wMsg As Long, _
    5.        ByVal wParam As Long, _
    6.        ByVal lParam As Long) As Long

    Code (Text):
    1.     <DllImport("user32.dll", SetLastError:=True, CharSet:=CharSet.Auto)> _
    2.     Private Shared Function PostMessage(ByVal hWnd As IntPtr, ByVal Msg As UInteger, ByVal wParam As IntPtr, ByVal lParam As IntPtr) As Boolean
    3.     End Function
    But still..I don't know how to use it,neither it does work when I'm trying to use it.
    Any solution? Or information/hints/tips you can give? :O

    Don't tell me to just use iMaxMacro or any other language please, I really want to do it in VB.NET (:

    Help appreciated,


Share This Page