简体   繁体   English

如何使用 GLFWwindow 指针获取 HWND?

[英]How to get HWND with GLFWwindow pointer?

I have the pointer of a GLFWwindow(It is a struct defined in glfw3.h, seems to be a openGL struct?).我有一个 GLFWwindow 的指针(它是一个在 glfw3.h 中定义的结构,似乎是一个 openGL 结构?)。 How can I use the pointer to get the HWND?如何使用指针获取 HWND?

GLFW has a section about native access there you can find this function that allows you to retrieve the HWND : GLFW 有一个关于本机访问的部分,您可以在那里找到此功能,该功能允许您检索HWND

HWND glfwGetWin32Window ( GLFWwindow * window) : HWND glfwGetWin32Window ( GLFWwindow * window)

Returns退货
The HWND of the specified window, or NULL if an error occurred.指定窗口的 HWND,如果发生错误,则为 NULL。
Thread safety线程安全
This function may be called from any thread.这个函数可以从任何线程调用。 Access is not synchronized.访问不同步。
Since自从
Added in version 3.0.在 3.0 版中添加。

Please read the documentation carefully:请仔细阅读文档:

By using the native access functions you assert that you know what you're doing and how to fix problems caused by using them.通过使用本机访问函数,您可以断言您知道自己在做什么以及如何解决因使用它们而导致的问题。 If you don't, you shouldn't be using them.如果你不这样做,你不应该使用它们。
Before the inclusion of glfw3native.h , you may define zero or more window system API macro and zero or more context creation API macros.在包含glfw3native.h之前,您可以定义零个或多个窗口系统 API 宏和零个或多个上下文创建 API 宏。
The chosen backends must match those the library was compiled for.选择的后端必须与编译库的后端匹配。 Failure to do this will cause a link-time error.不这样做将导致链接时间错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM