Hack Forums
[.NET] Mouse_event doesn't want to right click properly - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [.NET] Mouse_event doesn't want to right click properly (/showthread.php?tid=4830738)



Mouse_event doesn't want to right click properly - MrRapidz - May 21, 2015

Hi. I'm having troubles with right clicking with mouse_event

It right clicks fine but it acts like it holds down right click and doesn't let go. Basically the mouse_event(rightclickup) doesn't work properly it seems.

My code:

Code
mouse_event(rightclickdown, 0, 0, 0, 0)
            System.Threading.Thread.Sleep(50)
            mouse_event(rightclickup, 0, 0, 0, 0)

declarements:

Code
Private Const rightclickdown = 8
    Private Const rightclickup = 10
    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)



* - SaketSaket - May 21, 2015

Check this - http://www.homeandlearn.co.uk/NET/nets10p2.html

It may help you ;)


* - MrRapidz - May 21, 2015

(May 21, 2015 09:29 AM)SaketSaket Wrote:  Check this - http://www.homeandlearn.co.uk/NET/nets10p2.html

It may help you ;)

This has nothing to do with what I'm trying to achieve :P


* - $uicidal - May 21, 2015

Code
mouse_event(rightclickdown, 0, 0, 0, 1)
System.Threading.Thread.Sleep(50)
mouse_event(rightclickup, 0, 0, 0, 1)

Fixed


* - MrRapidz - May 21, 2015

(May 21, 2015 10:41 AM)Lawlly Wrote:  
Code
mouse_event(rightclickdown, 0, 0, 0, 1)
System.Threading.Thread.Sleep(50)
mouse_event(rightclickup, 0, 0, 0, 1)

Fixed

Can you explain what the change does bro? :P

edit: It doesn't work. It still acts like it just holds down right click.


* - $uicidal - May 21, 2015

(May 21, 2015 10:54 AM)MrRapidz Wrote:  Can you explain what the change does bro? :P

edit: It doesn't work. It still acts like it just holds down right click.

Was it doing the same thing before?


* - MrRapidz - May 21, 2015

(May 21, 2015 11:22 AM)Lawlly Wrote:  Was it doing the same thing before?

Yeah the fix you sent literally changed nothing


* - $uicidal - May 21, 2015

Code
mouse_event(&H2, 0, 0, 0, 1)
System.Threading.Thread.Sleep(50)
mouse_event(&H4, 0, 0, 0, 1)
Test that, tell me if it left clicks and releases


* - MrRapidz - May 21, 2015

(May 21, 2015 11:24 AM)Lawlly Wrote:  
Code
mouse_event(&H2, 0, 0, 0, 1)
System.Threading.Thread.Sleep(50)
mouse_event(&H4, 0, 0, 0, 1)
Test that, tell me if it left clicks and releases

I do already have the left click working and yeah it releases. Idk why right click doesn't.


* - $uicidal - May 21, 2015

Replace the variable names with the actual hex values, and make sure you have the right values


* - MrRapidz - May 21, 2015

(May 21, 2015 11:27 AM)Lawlly Wrote:  Replace the variable names with the actual hex values, and make sure you have the right values

What is the actual hex values for right click?


* - $uicidal - May 21, 2015

I tried searching for a list, but couldn't find one.

Private Const rightclickdown = 8
Private Const rightclickup = 10
They're the ones your already had, your issue could be that you're not referencing them as hex values but just numders.

Private Const rightclickdown as Integer = &H8
Private Const rightclickup As Integer = &H10


* - MrRapidz - May 21, 2015

(May 21, 2015 11:33 AM)Lawlly Wrote:  I tried searching for a list, but couldn't find one.

Private Const rightclickdown = 8
Private Const rightclickup = 10
They're the ones your already had, your issue could be that you're not referencing them as hex values but just numders.

Private Const rightclickdown as Integer = &H8
Private Const rightclickup As Integer = &H10

Lol that fixed it, thanks bro :D