alexmidre Posted April 4, 2016 Share Posted April 4, 2016 SendInput code (API) It doesn't work -Func ClickUpMouseButton() Local Const $INPUT_MOUSE = 0 Local Const $MOUSEEVENTF_LEFTDOWN = 0x0002 Local Const $MOUSEEVENTF_LEFTUP = 0x0004 Local Const $tagINPUT_mouse = "DWORD type;long dx;long dy;long mouseData;DWORD dwFlags;DWORD time;ULONG_PTR dwExtraInfo;dword;ULONG_PTR;" $NOTIFY = DllStructCreate($tagINPUT_mouse) _ZeroMemory($NOTIFY) DllStructSetData($NOTIFY, "type", $INPUT_MOUSE) DllStructSetData($NOTIFY, "dwFlags", $MOUSEEVENTF_LEFTDOWN) SendInput($NOTIFY) _ZeroMemory($NOTIFY) DllStructSetData($NOTIFY, "type", $INPUT_MOUSE) DllStructSetData($NOTIFY, "dwFlags", $MOUSEEVENTF_LEFTUP) SendInput($NOTIFY) EndFunc Func SendInput($NOTIFY) Local $sendDLL = DllOpen("user32.dll") $ret = DllCall($sendDLL, "uint", "SendInput", "uint", 2, "ptr", DllStructGetPtr($NOTIFY), "int", DllStructGetSize($NOTIFY)/2) DllClose($sendDLL) return $ret EndFunc Func _ZeroMemory(ByRef $struct) Local $temp = DllStructCreate("byte[" & DllStructGetSize($struct) & "]", DllStructGetPtr($struct)) For $i = 1 To DllStructGetSize($temp) DllStructSetData($temp, 1, 0, $i) Next EndFunc Link to comment Share on other sites More sharing options...
AutoBert Posted April 4, 2016 Share Posted April 4, 2016 Make a small runable reproducer script which have the issue. alexmidre 1 Link to comment Share on other sites More sharing options...
MagnumXL Posted April 4, 2016 Share Posted April 4, 2016 I think that in the _ZeroMemory function you are setting the parts of the "$temp" struct, but the function is ByRef'ing the "$struct" struct. Those are never seen outside the Function. That's just a shot in the dark. Like AutoBert said, we really need more to work with. Why not just use MouseClick() or MouseDown() & MouseUp()? alexmidre 1 Link to comment Share on other sites More sharing options...
alexmidre Posted April 4, 2016 Author Share Posted April 4, 2016 1 hour ago, MagnumXL said: I think that in the _ZeroMemory function you are setting the parts of the "$temp" struct, but the function is ByRef'ing the "$struct" struct. Those are never seen outside the Function. That's just a shot in the dark. Like AutoBert said, we really need more to work with. Why not just use MouseClick() or MouseDown() & MouseUp()? I do not want to call MouseClick, MouseDown, MouseUp (API -> mouse_event) Thanks you for helping Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now