capturing the mouse and WM_COMMAND
I only use the handle. Whenever I receive WM_LBUTTONDOWN, I do SetCapture(hWnd) and if I receive WM_LBUTTONUP, I do ReleaseCapture().
you''ll need to create a subclass of the BUTTON WndClass in order to install a custom message handler to get at the events. How to do that is explained in the MSDN manual under Subclassing a Window.
I know, I allready did. see http://www.gamedev.net/community/forums/topic.asp?topic_id=135511
Here is a window-procedure that shows the problem:
[edited by - Koen on January 28, 2003 7:07:18 PM]
LRESULT CALLBACK WndProc( HWND handle, UINT messg,WPARAM wParam, LPARAM lParam ){ if(handle==hWnd2) { //hWnd2 is the handle for the button if(messg==WM_LBUTTONDOWN) { SetCapture(hWnd2); } if(messg==WM_LBUTTONUP) { ReleaseCapture(); } return CallWindowProc(old,hWnd2,messg,wParam,lParam); //old is the button-wndproc } switch(messg) { case WM_DESTROY: PostQuitMessage( 0 ); break; case WM_COMMAND: SetWindowText(hWnd,"OK"); //hWnd is the handle for the parent window, but this line never gets executed break; default: return( DefWindowProc( handle, messg, wParam, lParam ) ); } return( 0L );}
[edited by - Koen on January 28, 2003 7:07:18 PM]
Okay, and where are you posting the button notification that it''s been clicked to your main window? You''re either going to have to explicitly post it yourself, or call the control''s click handler, since you''ve overridden the WM_LBUTTONDOWN processing.
-fel
-fel
After processing WM_LBUTTONDOWN, CallWindowProc(.....) is executed. If the SetCapture(..) and ReleaseCapture() are commented out, everything works fine. So that can''t be the problem.
Post it anyway and see if it works. *shrug*
Messing with mouse capture can seriously screw things up.
The reason why that happens is tucked deeply away inside the .dll''s for visual studio.
-fel
Messing with mouse capture can seriously screw things up.
The reason why that happens is tucked deeply away inside the .dll''s for visual studio.
-fel
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement