Results 1 to 8 of 8
  1. #1
    KissU's Avatar
    Join Date
    Oct 2010
    Gender
    male
    Posts
    107
    Reputation
    10
    Thanks
    14
    My Mood
    Blah

    Can someone help with a mouse thing

    Hey guys, can someone help to with a code to when I click mouse go down? Im working in one thing and i need help i already set the thing just need how to make cursor move down.
    Thanks in advance.

  2. #2
    Hassan's Avatar
    Join Date
    May 2010
    Gender
    male
    Location
    System.Threading.Tasks
    Posts
    4,764
    Reputation
    495
    Thanks
    2,133
    My Mood
    Dead
    [highlight=c++]#include <iostream>
    #include <Windows.h>
    void main()
    {
    while (true)
    {
    if(GetAsyncKeyState(VK_LBUTTON))
    {
    int x = 50;
    int y = 60;
    SetCursorPos(x ,y);
    }
    }
    }[/highlight]

    You use the GetAsyncKeyState function to check whether the Left Button is down, if so, you simply set the cursor position specified by x and y parameters. Both these functions reside in Windows.h header file.

  3. #3
    KissU's Avatar
    Join Date
    Oct 2010
    Gender
    male
    Posts
    107
    Reputation
    10
    Thanks
    14
    My Mood
    Blah
    @Hassan let i put my source
    Code:
    #include <windows.h>
    
    int main()
    {
        while(true) // Infinite loop
        {
    
              if(GetAsyncKeyState(VK_LBUTTON)&1) // If left mouse button is clicked
        {
              int x = 0;
              int y = 0;
         SetCursorPos(x,y);//Set position of cursor 
         Sleep(500); //0.5 sec of cpu relief :)
         }
    }
    }
    But i want whtn i click id go ↓ understand?
    Last edited by KissU; 08-28-2011 at 05:56 PM.
    "More suicides in world make there are less suicides in the world"


  4. #4
    Hassan's Avatar
    Join Date
    May 2010
    Gender
    male
    Location
    System.Threading.Tasks
    Posts
    4,764
    Reputation
    495
    Thanks
    2,133
    My Mood
    Dead
    Quote Originally Posted by KissU View Post
    @Hassan let i put my source
    Code:
    #include <windows.h>
    
    int main()
    {
        while(true) // Infinite loop
        {
    
              if(GetAsyncKeyState(VK_LBUTTON)&1) // If left mouse button is clicked
        {
              int x = 0;
              int y = 0;
         SetCursorPos(x,y);//Set position of cursor 
         Sleep(500); //0.5 sec of cpu relief :)
         }
    }
    }
    But i want whtn i click id go ↓ understand?
    [highlight=c++]void main()
    {
    while (true)
    {
    if(GetAsyncKeyState(VK_LBUTTON)&1)
    {
    POINT cursorPos;
    GetCursorPos(&cursorPos);
    int x = cursorPos.x ;
    int y = cursorPos.y +50 ;


    SetCursorPos(x ,y);
    }
    }

    }[/highlight]

    You first create a POINT. Get Cursor's current position using GetCursorPos function by passing cursorPos as a parameter so it can have the cursor's position. Then you assign the x position of the cursor to integer x, and y position of the cursor to integer y, except that you manually set it to go down 50 pixels by specifying +50. Finally you set the cursor position using SetCursorPos function.
    @KissU

  5. #5
    KissU's Avatar
    Join Date
    Oct 2010
    Gender
    male
    Posts
    107
    Reputation
    10
    Thanks
    14
    My Mood
    Blah
    @Hassan i did just like you said but when i click it go too much down like to taskbar so i trie d with y + 1 and still going ;x
    "More suicides in world make there are less suicides in the world"


  6. #6
    Hassan's Avatar
    Join Date
    May 2010
    Gender
    male
    Location
    System.Threading.Tasks
    Posts
    4,764
    Reputation
    495
    Thanks
    2,133
    My Mood
    Dead
    Quote Originally Posted by KissU View Post
    @Hassan i did just like you said but when i click it go too much down like to taskbar so i trie d with y + 1 and still going ;x
    That's not possible with my code. Post your complete code here.
    @KissU

  7. #7
    KissU's Avatar
    Join Date
    Oct 2010
    Gender
    male
    Posts
    107
    Reputation
    10
    Thanks
    14
    My Mood
    Blah
    Requesting closed Thank you @Hassan
    I'm going get work, thanks for helping. =)
    "More suicides in world make there are less suicides in the world"


  8. #8
    Hassan's Avatar
    Join Date
    May 2010
    Gender
    male
    Location
    System.Threading.Tasks
    Posts
    4,764
    Reputation
    495
    Thanks
    2,133
    My Mood
    Dead
    Quote Originally Posted by KissU View Post
    Requesting closed Thank you @Hassan
    I'm going get work, thanks for helping. =)
    LOL. Alright. NP.
    /Closed.

Similar Threads

  1. can someone help with my hw...
    By ZeroXD in forum Homework & Learning Section
    Replies: 7
    Last Post: 09-24-2011, 09:14 PM
  2. [Help] CAN SOMEONE HELP WITH INJECTOR ISSUES?
    By 13radP in forum Operation 7 General
    Replies: 5
    Last Post: 12-20-2010, 12:45 AM
  3. Can someone help with controls? (C# Windows Froms)
    By XxTylerxX in forum C# Programming
    Replies: 11
    Last Post: 12-05-2010, 07:45 PM
  4. Can someone help with nickname?
    By gsingh1 in forum WarRock Discussions
    Replies: 7
    Last Post: 09-15-2010, 10:10 PM
  5. please can someone help me with 'Nexon Game Manager'
    By angrytater in forum WarRock Korea Hacks
    Replies: 2
    Last Post: 09-29-2007, 02:44 PM