hey how do u use amouse in c++,is it possible and if yes to what extent,right click??
Printable View
hey how do u use amouse in c++,is it possible and if yes to what extent,right click??
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
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...Quote:
Originally Posted by phoenixmajestic
http://www.lawrencegoetz.com/programs/mousepractice/Quote:
Originally Posted by phoenixmajestic
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.
thanks guys