开发者

Windows API CreateWindow client size mouse position

Working with OpenGL, I used

CreateWindow( 
"app", "App Window", 
WS_CAPTION | WS_POPUPWINDOW | WS_VISIBLE | WS_SIZEBOX | WS_MINIMIZEBOX | WS_MAXIMIZEBOX,
0, 0, 1024, 768,
NUL开发者_Python百科L, NULL, hInstance, this );

to create a window and now I need to find the mouse position over the client (render) area. However, I noticed that the mouse coordinates extends all the way into the title/caption bar and this will give a wrong mouse-to-screen-to-world coordinate. I could find the fixed offset by trial and error, but is there a proper flag/trick to get the client mouse coord?

Thanks!


use GetCursorPos http://msdn.microsoft.com/en-us/library/ms648390%28VS.85%29.aspx to get the mouse position and then convert it to client-space using GetClientRect msdn.microsoft.com/en-us/library/ms633503%28VS.85%29.aspx (cant post >1 urls atm)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜