Results 1 to 2 of 2
  1. #1
    Unkn0wn_h4cker's Avatar
    Join Date
    Mar 2010
    Gender
    male
    Posts
    38
    Reputation
    10
    Thanks
    17

    Post [Tutorial]Mouse Coords[MSDN]

    Well,I looked around to find the easiest and most simple way to get the co-ordinates of your mouse without having to use api's.

    I got some feedback on this forum on how you guys would go about it, and took from that what I learnt, and wrote it how I would go about it( I didn't use anyone elses code as for some reason they didn't work for me or when they did they only got the position within the form)

    Ok so first download the coordinate finder,after that feel free to follow the tutorial if you wan't to know how to make the mouse move to a certain position and click ect.

    Ok so first you have to declare these under Public class Form1(These pretty much just tell the program that you'r going to be using the mouse)
    Code:
        
    'Handles the Mouse Cursor Clicking
        Private Const MOUSEEVENTF_LEFTDOWN = &H2
        Private Const MOUSEEVENTF_LEFTUP = &H4
        Private Const MOUSEEVENTF_RIGHTDOWN = &H8
        Private Const MOUSEEVENTF_RIGHTUP = &H10
        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)
        'Handles the Mouse Cursor Position
        Private Declare Sub SetCursorPos Lib "User32" (ByVal X As Integer, ByVal Y As Integer)
    Now that you have declared those go ahead and make a button or something similar and double click it.

    Under it type:

    Code:
            Dim MousePositionX As Integer = xxx
            Dim MousePositionY As Integer = xxx
    This is where the program listed below would come in handy,you need the x and y coordinates to fill in the "xxx's" Which will tell the program where you wan't the mouse to be on your screen.

    Now just press enter and type this:

    Code:
            SetCursorPos(MousePositionX, MousePositionY)
    
            mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0)
            mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)
    Ok so,pretty self explanatory,set cursor pos will set the position you specified above,and mouse_event will hold left click down,then bring it back up,you can use (RIGHTDOWN,RIGHTUP,LEFTDOWN,LEFTUP) and I'm pretty sure you can use the middle button on the mouse too.

    So just quickly so you all understand,if you wan'ted it to go left click then right click then you could go

    Code:
    mouse_event(MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0)
    mouse_event(MOUSEEVENTF_UP, 0, 0, 0, 0)
            mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0)
    mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)
    Thankyou hope you can understand.Have fun

    First ones just .exe
    seconds .exe + source
    Last edited by Unkn0wn_h4cker; 03-15-2010 at 05:51 AM.

  2. The Following 6 Users Say Thank You to Unkn0wn_h4cker For This Useful Post:

    Cryptonic (03-27-2013),frizzzy (08-08-2011),jecsz (05-31-2011),loveundermytail (08-20-2013),Qizzle15401 (05-11-2010),SoldierFront (05-31-2010)

  3. #2
    NextGen1's Avatar
    Join Date
    Dec 2009
    Gender
    male
    Location
    Not sure really.
    Posts
    6,312
    Reputation
    382
    Thanks
    3,019
    My Mood
    Amazed
    Approved..


     


     


     



    The Most complete application MPGH will ever offer - 68%




Similar Threads

  1. Get Mouse Coords?
    By ipwnuuaal5 in forum Combat Arms Coding Help & Discussion
    Replies: 13
    Last Post: 10-15-2010, 05:21 AM
  2. [Tutorial]How to possess somebody's mouse.
    By Kallisti in forum Programming Tutorials
    Replies: 21
    Last Post: 09-14-2010, 12:21 AM
  3. Warrock Hack - Tutorial
    By Dave84311 in forum WarRock - International Hacks
    Replies: 667
    Last Post: 10-09-2007, 10:10 AM
  4. Replies: 3
    Last Post: 01-04-2006, 09:52 PM
  5. Photoshop Tutorials
    By Dave84311 in forum Art & Graphic Design
    Replies: 3
    Last Post: 12-31-2005, 07:21 AM