Windows API CreateWindow 客户端大小 鼠标位置
我使用 OpenGL
CreateWindow(
"app", "App Window",
WS_CAPTION | WS_POPUPWINDOW | WS_VISIBLE | WS_SIZEBOX | WS_MINIMIZEBOX | WS_MAXIMIZEBOX,
0, 0, 1024, 768,
NULL, NULL, hInstance, this );
来创建一个窗口,现在我需要找到客户端(渲染)区域上的鼠标位置。但是,我注意到鼠标坐标一直延伸到标题/标题栏,这将给出错误的鼠标到屏幕到世界的坐标。我可以通过反复试验找到固定偏移量,但是是否有适当的标志/技巧来获取客户端鼠标坐标?
谢谢!
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,
NULL, 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!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用 GetCursorPos http://msdn.microsoft.com/en -us/library/ms648390%28VS.85%29.aspx 获取鼠标位置,然后使用 GetClientRect 将其转换为客户端空间 msdn.microsoft.com/en-us/library/ms633503%28VS.85 %29.aspx(无法发布 >1 个 url atm)
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)