Skip to main content
gamedev.net
🔒 Locked

Mouse click trouble!!!

Started by Khayman Dec 2, 2001 at 6:38 PM 1 replies 200+ views
Original Post
Khayman
Khayman
I search a tutorial or a fonction, if its not to much, for clicking on the mouse .(LeftBotton... ???) I use the windows mouse not a direct input. plz...
element2001
element2001
Yeah in LRESULT CALLBACK WndProc add these case statements:

  
case WM_LBUTTONDOWN:
{
code to handle when left mouse button is down
return 0;
}

case WM_RBUTTONDOWN:
{
code to handle when right mouse button is down
return 0;
}

case WM_LBUTTONUP:
{
code to handle when left mouse button is up
return 0;
}

case WM_RBUTTONUP:
{
code to handle when right mouse button is up
return 0;
}
smart_idiot
smart_idiot
If you have your thing set to catch double clicks, you won''t get the message if the user clicks very quickly. You get WM_LBUTTONDBLCLK instead. If that''s a problem, you can change the windows class style, or you can write it as:

  
case WM_LBUTTONDBLCLK:
case WM_LBUTTONDOWN:
{
code to handle when left mouse button is down
return 0;
}


If the opposite is true, you can have those for seperate cases, and you need to set the flag CS_DBLCLKS in the style part of your window class.




Off Topic:
You know, I can make dos code look artistic, but my windows code always looks like crap. What up with that? That''s why I always hide my windows code in some file that nobody would ever look at, like ''ugly_windows_code_dont_look_at_it_or_you_will_die_and_i_cant_be_held_responsible.yuck''

and then my make entry part of my program into something like this:

--main.cpp--
#include "ugly_windows_code_dont_look_at_it_or_you_will_die_and_i_cant_be_held_responsible.yuck"
--End of main.cpp--

Which is much nicer to look at, and it adds a sense of mystery to the debugging process.
Chess is played by three people. Two people play the game; the third provides moral support for the pawns. The object of the game is to kill your opponent by flinging captured pieces at his head. Since the only piece that can be killed is a pawn, the two armies agree to meet in a pawn-infested area (or even a pawn shop) and kill as many pawns as possible in the crossfire. If the game goes on for an hour, one player may legally attempt to gouge out the other

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.