By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,871 Members | 2,464 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,871 IT Pros & Developers. It's quick & easy.

PInvokeStackImbalance was detected?

jamesd0142
100+
P: 469
Can Anyone advise?
i found the following code online:
Expand|Select|Wrap|Line Numbers
  1. Public Declare Auto Function SetCursorPos Lib "User32.dll" (ByVal X As Integer, ByVal Y As Integer) As Long
  2.     Public Declare Auto Function GetCursorPos Lib "User32.dll" (ByRef lpPoint As Point) As Long
  3.     Public Declare Sub mouse_event Lib "user32" Alias "mouse_event" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)
  4.     Public Const MOUSEEVENTF_LEFTDOWN = &H2 ' left button down
  5.     Public Const MOUSEEVENTF_LEFTUP = &H4 ' left button up
  6.     Public Const MOUSEEVENTF_MIDDLEDOWN = &H20 ' middle button down
  7.     Public Const MOUSEEVENTF_MIDDLEUP = &H40 ' middle button up
  8.     Public Const MOUSEEVENTF_RIGHTDOWN = &H8 ' right button down
  9.     Public Const MOUSEEVENTF_RIGHTUP = &H10 ' right button up
  10.  
When i use this code was was part of the code i found:
Expand|Select|Wrap|Line Numbers
  1. mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0)
  2.         mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)
  3.  
I get an error...

Please look at attchment...

Can anyone explain it?

James
Attached Images
File Type: jpg Error.JPG (19.9 KB, 176 views)
Apr 15 '08 #1
Share this Question
Share on Google+
1 Reply


jamesd0142
100+
P: 469
Never mind..

This seems to work now...

Expand|Select|Wrap|Line Numbers
  1. Declare Sub mouse_event Lib "user32" Alias "mouse_event" (ByVal dwFlags As Integer, ByVal dx As Integer, ByVal dy As Integer, ByVal cButtons As Integer, ByVal dwExtraInfo As Integer)
  2.     Private Const MOUSEEVENTF_ABSOLUTE = &H8000 ' absolute move    
  3.     Private Const MOUSEEVENTF_LEFTDOWN = &H2 ' left button down    
  4.     Private Const MOUSEEVENTF_LEFTUP = &H4 ' left button up    
  5.     Private Const MOUSEEVENTF_MOVE = &H1 ' mouse move    
  6.     Private Const MOUSEEVENTF_MIDDLEDOWN = &H20
  7.     Private Const MOUSEEVENTF_MIDDLEUP = &H40
  8.     Private Const MOUSEEVENTF_RIGHTDOWN = &H8
  9.     Private Const MOUSEEVENTF_RIGHTUP = &H10
  10.  
  11. mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 1)
  12.         mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)
  13.  
Apr 15 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.