简体   繁体   中英

How to add a child window created by GLFW to C# panel?

I've got the handle of the parent window created by C#, and here is the code:

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

but it won't work and doesn't show the window.I guess it might be the dwStyle and the dwExStyle that work on it.

You need to call ShowWindow for showing. You just create, but you don't show

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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