Có. Bạn có thể dùng file thư viện graphics.h để làm việc đó. Đây là một số hàm về chuột:
void getmouseclick( int kind, int& x, int& y );
-> lấy tọa độ x,y ( theo pixel) mà ở đó có click
bool ismouseclick( int kind );
-> trả về true nếu xảy ra click
int mousex( );-> lấy tọa độ chuột theo trục x
int mousey( );-> tọa độ chuột theo trục y
kind có các giá trị thế này:
Code:
WM_MOUSEMOVE
if you want to detect a mouse movement
WM_LBUTTONDBLCLK
...detect when the left mouse button is double clicked
WM_LBUTTONDOWN
...detect when the left mouse button is clicked down
WM_LBUTTONUP
...detect when the left mouse button is released up
WM_MBUTTONDBLCLK
...detect when the middle mouse button is double clicked
WM_MBUTTONDOWN
...detect when the middle mouse button is clicked down
WM_MBUTTONUP
...detect when the middle mouse button is released up
WM_RBUTTONDBLCLK
...detect when the right mouse button is double clicked
WM_RBUTTONDOWN
...detect when the right mouse button is clicked down
WM_RBUTTONUP
void clearmouseclick( int kind );
void clearresizeevent( );
bool isresizeevent( );
void registermousehandler( int kind, void h( int, int ) );
void setmousequeuestatus( int kind, bool status=true );
Mấy hàm ở sau tớ ko nhớ chức năgn, bạn có thể tra cứu trên mạng.