PInvokeStackImbalance was detected?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jamesd0142
    Contributor
    • Sep 2007
    • 471

    PInvokeStackImbalance was detected?

    Can Anyone advise?
    i found the following code online:
    [code=vbnet]
    Public Declare Auto Function SetCursorPos Lib "User32.dll " (ByVal X As Integer, ByVal Y As Integer) As Long
    Public Declare Auto Function GetCursorPos Lib "User32.dll " (ByRef lpPoint As Point) As Long
    Public Declare Sub mouse_event Lib "user32" Alias "mouse_even t" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)
    Public Const MOUSEEVENTF_LEF TDOWN = &H2 ' left button down
    Public Const MOUSEEVENTF_LEF TUP = &H4 ' left button up
    Public Const MOUSEEVENTF_MID DLEDOWN = &H20 ' middle button down
    Public Const MOUSEEVENTF_MID DLEUP = &H40 ' middle button up
    Public Const MOUSEEVENTF_RIG HTDOWN = &H8 ' right button down
    Public Const MOUSEEVENTF_RIG HTUP = &H10 ' right button up
    [/code]

    When i use this code was was part of the code i found:
    [code=vbnet]
    mouse_event(MOU SEEVENTF_LEFTDO WN, 0, 0, 0, 0)
    mouse_event(MOU SEEVENTF_LEFTUP , 0, 0, 0, 0)
    [/code]

    I get an error...

    Please look at attchment...

    Can anyone explain it?

    James
    Attached Files
  • jamesd0142
    Contributor
    • Sep 2007
    • 471

    #2
    Never mind..

    This seems to work now...

    [code=vbnet]
    Declare Sub mouse_event Lib "user32" Alias "mouse_even t" (ByVal dwFlags As Integer, ByVal dx As Integer, ByVal dy As Integer, ByVal cButtons As Integer, ByVal dwExtraInfo As Integer)
    Private Const MOUSEEVENTF_ABS OLUTE = &H8000 ' absolute move
    Private Const MOUSEEVENTF_LEF TDOWN = &H2 ' left button down
    Private Const MOUSEEVENTF_LEF TUP = &H4 ' left button up
    Private Const MOUSEEVENTF_MOV E = &H1 ' mouse move
    Private Const MOUSEEVENTF_MID DLEDOWN = &H20
    Private Const MOUSEEVENTF_MID DLEUP = &H40
    Private Const MOUSEEVENTF_RIG HTDOWN = &H8
    Private Const MOUSEEVENTF_RIG HTUP = &H10

    mouse_event(MOU SEEVENTF_LEFTDO WN, 0, 0, 0, 1)
    mouse_event(MOU SEEVENTF_LEFTUP , 0, 0, 0, 0)
    [/code]

    Comment

    Working...