Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

.NET 

Mouse Click, Center Of Form Or Webbrowser?

Hello HF
i tried many ways of mouse click but no luck, tried searching but only found giving coords.
i want a mouse click to happen in the middle of the form so no matter where the form is (top screen, bottom) it will click in the center of the form
Buying BTC for PP, PM me for exchange! @ 10%
If you placed whatever is in the middle of the forum, call its click event instead.
(Oct 1, 2015 08:29 AM)Odus Wrote:  If you placed whatever is in the middle of the forum, call its click event instead.

not sure? i dont mean like when mouse clicks, like i need the mouse to click in center of browser or form(same thing)
Buying BTC for PP, PM me for exchange! @ 10%
(Oct 1, 2015 08:32 AM)Lexxi. Wrote:  not sure? i dont mean like when mouse clicks, like i need the mouse to click in center of browser or form(same thing)

There was no mention of a browser in the OP. Instead of clicking the control, get the button or whatever on the web page it is' ID then invoke a click on it.
(Oct 1, 2015 08:34 AM)Odus Wrote:  There was no mention of a browser in the OP. Instead of clicking the control, get the button or whatever on the web page it is' ID then invoke a click on it.

haha, thats what i use for buttons but this one doesnt have a button, its a game, when i inspect element outside it (the page) it gives element id but not for game only gives java options
Buying BTC for PP, PM me for exchange! @ 10%
Make a new Point and divide the form width and height by 2, then invoke a mouseclick on that Point
Code
Private Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Integer, ByVal dx As Integer, ByVal dy As Integer, ByVal cButtons As Integer, ByVal dwExtraInfo As Integer)
    Sub MouseClickCenter()
        Dim x As Integer = CInt(Me.Left + (Me.Width / 2))
        Dim y As Integer = CInt(Me.Top + (Me.Height / 2))
        Cursor.Position = New Point(x, y)
        mouse_event(&H2, 0, 0, 0, 0)
        mouse_event(&H4, 0, 0, 0, 0)
    End Sub
i have made you this code try it 🤝
(Oct 1, 2015 08:48 AM)bho007 Wrote:  
Code
Private Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Integer, ByVal dx As Integer, ByVal dy As Integer, ByVal cButtons As Integer, ByVal dwExtraInfo As Integer)
    Sub MouseClickCenter()
        Dim x As Integer = CInt(Me.Left + (Me.Width / 2))
        Dim y As Integer = CInt(Me.Top + (Me.Height / 2))
        Cursor.Position = New Point(x, y)
        mouse_event(&H2, 0, 0, 0, 0)
        mouse_event(&H4, 0, 0, 0, 0)
    End Sub
i have made you this code try it 🤝

thanks alot, i had this code, my bad should of just use the me.width/2)) at end of it, thanks though


Thread closed- thanks for the code again :)
Buying BTC for PP, PM me for exchange! @ 10%


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Python] by SurHommeOct 1, 2022 03:25 PM 9 299 Oct 1, 2022 03:25 PM
Last Post: MeyerWolfsheim
[.NET] by unknown321Jan 5, 2022 03:59 PM 10 366 Jan 5, 2022 03:59 PM
Last Post: wannabenyhm
[.NET] by PrisoftApr 18, 2021 09:02 AM 0 141 Apr 18, 2021 09:02 AM
Last Post: Prisoft