如何将 GLFW 创建的子 window 添加到 C# 面板?
How to add a child window created by GLFW to C# panel?
我得到了由 C# 创建的父 window 的句柄,下面是代码:
window->win32.dwStyle = WS_CLIPSIBLINGS | WS_CLIPCHILDREN LWS_CHILDWINDOW| WS_VISIBLE;
window->win32.dwExStyle = WS_EX_APPWINDOW | WS_EX_WINDOWEDGE;
CreateWindowExW(window->win32.dwExStyle,
_GLFW_WNDCLASSNAME,
wideTitle,
window->win32.dwStyle,
xpos, ypos,
fullWidth, fullHeight,
window->win32.parentHandle, // will modified
NULL, // No window menu
GetModuleHandleW(NULL),
window); // Pass object to WM_CREATE
但它不会工作,也不会显示 window.I 猜测可能是 dwStyle 和 dwExStyle 在它上面工作。
您需要调用ShowWindow 来显示。你只创造,不展示
HWND hwnd=CreateWindowExW(window->win32.dwExStyle,
_GLFW_WNDCLASSNAME,
wideTitle,
window->win32.dwStyle,
xpos, ypos,
fullWidth, fullHeight,
window->win32.parentHandle, // will modified
NULL, // No window menu
GetModuleHandleW(NULL),
NULL); // //here is NULL
ShowWindow(hwnd, nCmdShow);//nCmdShow is int
UpdateWindow(hwnd);//For sure you update window.
我得到了由 C# 创建的父 window 的句柄,下面是代码:
window->win32.dwStyle = WS_CLIPSIBLINGS | WS_CLIPCHILDREN LWS_CHILDWINDOW| WS_VISIBLE;
window->win32.dwExStyle = WS_EX_APPWINDOW | WS_EX_WINDOWEDGE;
CreateWindowExW(window->win32.dwExStyle,
_GLFW_WNDCLASSNAME,
wideTitle,
window->win32.dwStyle,
xpos, ypos,
fullWidth, fullHeight,
window->win32.parentHandle, // will modified
NULL, // No window menu
GetModuleHandleW(NULL),
window); // Pass object to WM_CREATE
但它不会工作,也不会显示 window.I 猜测可能是 dwStyle 和 dwExStyle 在它上面工作。
您需要调用ShowWindow 来显示。你只创造,不展示
HWND hwnd=CreateWindowExW(window->win32.dwExStyle,
_GLFW_WNDCLASSNAME,
wideTitle,
window->win32.dwStyle,
xpos, ypos,
fullWidth, fullHeight,
window->win32.parentHandle, // will modified
NULL, // No window menu
GetModuleHandleW(NULL),
NULL); // //here is NULL
ShowWindow(hwnd, nCmdShow);//nCmdShow is int
UpdateWindow(hwnd);//For sure you update window.