Windows API CreateWindow 客户端大小 鼠标位置

发布于 2024-09-28 05:16:08 字数 352 浏览 1 评论 0原文

我使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

古镇旧梦 2024-10-05 05:16:08

使用 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)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文