Mouse in c++
Results 1 to 8 of 8

Thread: Mouse in c++

  1. #1
    Junior Member phoenixmajestic's Avatar
    Join Date
    Sep 2006
    Posts
    14

    Post Mouse in c++

    hey how do u use amouse in c++,is it possible and if yes to what extent,right click??
    [/color][glowpurple]The ladder of sucess is never crowded at top:Napolean[/glowpurple]

  2. #2
    Super Moderator
    Know-it-All Master Beaver

    Join Date
    Jan 2003
    Posts
    3,914
    What do you mean by "use a mouse"???

    C++ is a programming language..

    You can write code to take advantage of mouse clicks, mouse movement and everything in between..

    Are you talking about your C++ IDE? Then the answer would be it depends on the IDE.. but 99.9% of the time yes you could use the mouse.(unless you're using a console editor like vi or pico (at a console without a mouse))

    Peace,
    HT
    IT Blog: .:Computer Defense:.
    PnCHd (Pronounced Pinched): Acronym - Point 'n Click Hacked. As in: "That website was pinched" or "The skiddie pinched my computer because I forgot to patch".

  3. #3
    Junior Member phoenixmajestic's Avatar
    Join Date
    Sep 2006
    Posts
    14
    could u gimme an example or tell me where i cud get some info abt this
    [/color][glowpurple]The ladder of sucess is never crowded at top:Napolean[/glowpurple]

  4. #4
    Super Moderator
    Know-it-All Master Beaver

    Join Date
    Jan 2003
    Posts
    3,914
    Quote Originally Posted by phoenixmajestic
    could u gimme an example or tell me where i cud get some info abt this
    About what??? (How about you type with proper spelling and punctuation as well)... There's nothing to tell you.. You still haven't said which you are talking about... If you want to utilize the mouse in a C++ program that you're writing... then go look up documentation based on the graphics libraries and GUI support that you are including...
    IT Blog: .:Computer Defense:.
    PnCHd (Pronounced Pinched): Acronym - Point 'n Click Hacked. As in: "That website was pinched" or "The skiddie pinched my computer because I forgot to patch".

  5. #5
    Just Another Geek
    Join Date
    Jul 2002
    Location
    Rotterdam, Netherlands
    Posts
    3,403
    Quote Originally Posted by phoenixmajestic
    could u gimme an example or tell me where i cud get some info abt this
    http://www.lawrencegoetz.com/programs/mousepractice/
    Oliver's Law:
    Experience is something you don't get until just after you need it.

  6. #6
    Super Moderator: GMT Zone nihil's Avatar
    Join Date
    Jul 2003
    Location
    United Kingdom: Bridlington
    Posts
    17,191
    If you cannot do someone any good: don't do them any harm....
    As long as you did this to one of these, the least of my little ones............you did it unto Me.
    What profiteth a man if he gains the entire World at the expense of his immortal soul?

  7. #7
    Junior Member -Chris-'s Avatar
    Join Date
    Nov 2006
    Location
    UK
    Posts
    11
    If you wish to use mouse clicks (this just works for clicking anywhere), then there is a way to do it in C++ (this will briefly tell you what to do):

    #define KEY_DOWN(key_code)((GetAsyncKeyState(key_code)&0x8000)?1:0)
    #define KEY_UP(key_code)((GetAsyncKeyState(key_code)&0x8000)?0:1)

    #define KEY_LBUTTON 1
    #define KEY_RBUTTON 2

    #include <windows.h>
    #include <iostream>

    using namespace std;

    int main()
    {
    while(1)
    {
    if(KEY_DOWN(KEY_LBUTTON)){cout<<"You have left mouse clicked"<<endl; Sleep(105);}
    if(KEY_DOWN(KEY_RBUTTON)){cout<<"You have right mouse click"<<endl; Sleep(105);}
    }
    }

    However bare in mind that this will work anywhere you click (outside of console, when console is minimised etc).

    Hope this helps.

  8. #8
    Junior Member phoenixmajestic's Avatar
    Join Date
    Sep 2006
    Posts
    14
    thanks guys
    [/color][glowpurple]The ladder of sucess is never crowded at top:Napolean[/glowpurple]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •