Thread: Mouse Click?

Results 1 to 15 of 15
  1. #1
    ipwnuuaal5's Avatar
    Join Date
    Mar 2010
    Gender
    male
    Posts
    275
    Reputation
    16
    Thanks
    33

    Mouse Click?

    How can you code a mouse click in game for a certain position?

  2. #2
    CodeDemon's Avatar
    Join Date
    Jul 2010
    Gender
    male
    Location
    vagina
    Posts
    1,074
    Reputation
    50
    Thanks
    936
    My Mood
    Fine
    What do you mean? Do you mean like, only allow the mouse action to be completed when the cursor is inside a box? Or just a mouse click?

  3. #3
    flashlight95's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    12-34 Poopie Street Posts: Over 9000!
    Posts
    128
    Reputation
    10
    Thanks
    15
    I think he means to make the mouse click when it is a a certain X,Y position on your screen.

  4. #4

  5. #5
    |Drake™|'s Avatar
    Join Date
    Aug 2010
    Gender
    male
    Posts
    365
    Reputation
    10
    Thanks
    84
    I think he wants to make, "autofire" .

  6. #6
    CodeDemon's Avatar
    Join Date
    Jul 2010
    Gender
    male
    Location
    vagina
    Posts
    1,074
    Reputation
    50
    Thanks
    936
    My Mood
    Fine
    first declare a point:

    Code:
    POINT position;
    Then use the GetCursorPos Function to get the cursor position:

    Code:
    GetCursorPos(&position);
    Afterwords come your if statements for the mouse click:

    Code:
    if(GetAsyncKeyState(VK_LEFT)<0){
    if((position.x > boxminwidth) && (position.x < boxmaxwidth) && ( position.y > boxminheight) && ( position.y < boxmaxheight)) {
    //ACTIONS HERE
    }
    }
    -----------------------------------------------------
    Edit: oh my bad I misread your reply. Above is for if you want to activate something when clicking inside a certain area /
    Last edited by CodeDemon; 08-27-2010 at 02:50 PM.

  7. #7
    Void's Avatar
    Join Date
    Sep 2009
    Gender
    male
    Location
    Inline.
    Posts
    3,193
    Reputation
    205
    Thanks
    1,438
    My Mood
    Mellow
    Found this after 2 seconds of googling. I bet your homepage is google and you don't even know how or when to use it.

    [php]
    void LeftClick ( )
    {
    INPUT Input={0};
    // left down
    Input.type = INPUT_MOUSE;
    Input.mi.dwFlags = MOUSEEVENTF_LEFTDOWN;
    ::SendInput(1,&Input,sizeof(INPUT));

    // left up
    ::ZeroMemory(&Input,sizeof(INPUT));
    Input.type = INPUT_MOUSE;
    Input.mi.dwFlags = MOUSEEVENTF_LEFTUP;
    ::SendInput(1,&Input,sizeof(INPUT));
    }

    [/php]

  8. The Following User Says Thank You to Void For This Useful Post:

    topblast (08-27-2010)

  9. #8
    |Drake™|'s Avatar
    Join Date
    Aug 2010
    Gender
    male
    Posts
    365
    Reputation
    10
    Thanks
    84
    Quote Originally Posted by Void View Post
    Found this after 2 seconds of googling. I bet your homepage is google and you don't even know how or when to use it.

    [php]
    void LeftClick ( )
    {
    INPUT Input={0};
    // left down
    Input.type = INPUT_MOUSE;
    Input.mi.dwFlags = MOUSEEVENTF_LEFTDOWN;
    ::SendInput(1,&Input,sizeof(INPUT));

    // left up
    ::ZeroMemory(&Input,sizeof(INPUT));
    Input.type = INPUT_MOUSE;
    Input.mi.dwFlags = MOUSEEVENTF_LEFTUP;
    ::SendInput(1,&Input,sizeof(INPUT));
    }

    [/php]
    I don't think he can understand us since he seems new to coding.

  10. #9
    ipwnuuaal5's Avatar
    Join Date
    Mar 2010
    Gender
    male
    Posts
    275
    Reputation
    16
    Thanks
    33
    No, I need mouse to automatically click on a certain location.

  11. #10
    Void's Avatar
    Join Date
    Sep 2009
    Gender
    male
    Location
    Inline.
    Posts
    3,193
    Reputation
    205
    Thanks
    1,438
    My Mood
    Mellow
    Quote Originally Posted by ipwnuuaal5 View Post
    No, I need mouse to automatically click on a certain location.
    I think you should read over my 2 posts and don't judge too quickly. The structure used in the SendInput has more members, that include the x and y coordinates of the mouse.

    You should really do some research on your own before posting here. It could really save us all the trouble of going through this meaningless attempt at helping someone that obviously doesn't know programming what so ever, if you did research before posting, you could've figured that out yourself.

  12. #11
    ipwnuuaal5's Avatar
    Join Date
    Mar 2010
    Gender
    male
    Posts
    275
    Reputation
    16
    Thanks
    33
    ok thanks void.
    i did my research

    this is how you do it.
    mouse_event(MOUSEEVENTF_LEFTDOWN, x, y, 0, 0);

  13. #12
    ac1d_buRn's Avatar
    Join Date
    Aug 2009
    Gender
    female
    Location
    CA Source Section
    Posts
    3,406
    Reputation
    157
    Thanks
    3,991
    My Mood
    Flirty
    SetCursorPos(..)

    or
    mouse_event(...)


  14. #13
    topblast's Avatar
    Join Date
    Mar 2010
    Gender
    male
    Location
    Far from around you Programmer: C++ | VB | C# | JAVA
    Posts
    3,607
    Reputation
    149
    Thanks
    4,922
    My Mood
    Cool
    GetAsyncKeyState(VK_LBUTTON) = true;

    I just like programming, that is all.

    Current Stuff:

    • GPU Programmer (Cuda)
    • Client/Server (Cloud Server)
    • Mobile App Development

  15. #14
    freedompeace's Avatar
    Join Date
    Jul 2010
    Gender
    female
    Posts
    3,035
    Reputation
    340
    Thanks
    2,784
    My Mood
    Sad
    Quote Originally Posted by topblast View Post
    GetAsyncKeyState(VK_LBUTTON) = true;

    You cannot SET the value in a GET statement.

  16. #15
    topblast's Avatar
    Join Date
    Mar 2010
    Gender
    male
    Location
    Far from around you Programmer: C++ | VB | C# | JAVA
    Posts
    3,607
    Reputation
    149
    Thanks
    4,922
    My Mood
    Cool
    Quote Originally Posted by ipwnuuaal5 View Post
    How can you code a mouse click in game for a certain position?
    SetCursorPos(x,y);

    I think that is it. I havent use that since my color aimbot


    Quote Originally Posted by freedompeace View Post
    You cannot SET the value in a GET statement.
    well what do u kno.. u learn something every day( i was just kidding i knew u could not do it like that)
    Last edited by topblast; 08-27-2010 at 06:49 PM.
    I just like programming, that is all.

    Current Stuff:

    • GPU Programmer (Cuda)
    • Client/Server (Cloud Server)
    • Mobile App Development

Similar Threads

  1. [HELP] Fast Mouse Click Code[Solved]
    By <(-_-)> in forum Visual Basic Programming
    Replies: 6
    Last Post: 04-01-2010, 09:41 PM
  2. [HELP]Fast Mouse Click[Solved]
    By <(-_-)> in forum Visual Basic Programming
    Replies: 5
    Last Post: 03-27-2010, 10:24 PM
  3. Method to Stimulate Mouse Clicks
    By zhaoyun333 in forum C++/C Programming
    Replies: 0
    Last Post: 01-23-2010, 11:10 PM
  4. Storing Mouse Clicks
    By gwentravolta in forum Visual Basic Programming
    Replies: 9
    Last Post: 11-07-2009, 04:38 AM
  5. Get Mouse Click
    By Xocitus in forum C++/C Programming
    Replies: 4
    Last Post: 07-11-2007, 10:47 PM