just a quick question thanks ->
GetCursorPos(&pos);
that gets the cursor position, but using the windows library, how do you
detect for mouse clicks?
mouse clicking windows library
Started by rouncer, Sep 19 2008 11:54 AM
4 replies to this topic
#1
Posted 19 September 2008 - 11:54 AM
#2
Posted 19 September 2008 - 04:59 PM
You receive a WM_LBUTTONDOWN message with your window.
You can also use SetCapture() to make Windows route all mouse clicks to your window whether they were actually on your window or not. But you still need to have a window.
You can also use SetCapture() to make Windows route all mouse clicks to your window whether they were actually on your window or not. But you still need to have a window.
reedbeta.com - developer blog, OpenGL demos, and other projects
#3
Posted 19 September 2008 - 05:46 PM
thankyou
#4
Posted 19 September 2008 - 09:48 PM
I think SetCapture() works only when you are dragging outside the window.. If you release the mousebutton the trap is lost.
#5
Posted 20 September 2008 - 10:08 PM
You can do everything just by watching windows messages.
WM_LBUTTONDOWN //When left mouse button is pressed down
WM_LBUTTONUP //When left mouse button is released
WM_MOUSEMOVE //When the mouse is moved
POINT pt;
pt.x = LOWORD(lParam);
pt.y = HIWORD(lParam);
this will give you mouse x,y coordinate
ClientToScreen(m_hWnd, &pt);
this will convert the coordinate to screen space
WM_LBUTTONDOWN //When left mouse button is pressed down
WM_LBUTTONUP //When left mouse button is released
WM_MOUSEMOVE //When the mouse is moved
POINT pt;
pt.x = LOWORD(lParam);
pt.y = HIWORD(lParam);
this will give you mouse x,y coordinate
ClientToScreen(m_hWnd, &pt);
this will convert the coordinate to screen space
3D OpenGL, C++ Game Development Video Tutorials @
www.marek-knows.com
www.marek-knows.com
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users












