-
Using mouse click
i would like to ask anyone who knows how to use a mouse click in C++. i want to use the mouse to enter a choice of list.
Eg.
LOGIN
REGISTER
EXIT
i wan to use my mouse to enter either one of the choice. can i do it using C++? is it possible? and i m using MinGW Studio Developer by the way. can anyone help me?
-
Is this for a console app or windowed app? What OS?
-
This is using window xp. i m not using VC++. n i m not sure what is console app o window app cos i m stil learning. what is the different, anyway?
-
a windows app is a windows application like an install programme,
it uses windows.h functions, a consol app is programmed differently, as for using a mouse with a consol app i don't know,
-
-
Are they buttons then (CreateWindow( "BUTTON"... ))? If so:
Code:
case WM_COMMAND:
switch( wParam )
{
case BUTTON_ID: //Replace this with the button's ID
//Do stuff
break;
case OTHER_BUTTON: //Again, replace this with the button's ID
//Do something else
break;
}
break;
should go in the window proc.
-
If it is instead a console application for Windows, you would ::SetConsoleMode(..) with ENABLE_MOUSE_INPUT. You then recieve mouse event notifications with a MOUSE_EVENT_RECORD structure, and a COORD of the mouse position in the dwMousePosition structure member.
-
what library do i have to include to use this mouse click function??
-
and one more thing, can someone explain to me how to use it?? cos i m new in programming and i dun know how to use it. if u can, gives some short example as wells. thanks!!!
-
if you're new, i wouldnt recommend atttempting windows programming until you are very comfortable at using and manipulating console apps, the fact that you werent aware of the difference would imply that either you havent scratched the surface of windows programming, or that you are relatively new to programming altogether. in the case of the former, there is a programmer on this forum who has a tutorial website -
http://www.adrianxw.dk/
a friend of mine has recently started windows programming and has come leaps and bounds in a really short time. as far i know, this site deals mostly with console apps that access winsows functions, so it would be a good starting point for someone interested in GUI.
however if you are the latter, think about writing more complex console apps before you try windows programming - its a whole different world in my opinion.
-
Thanks to all of u for helping me out!!! :)