[source lang=cpp]
WNDCLASSEX wc;
wc.cbSize = sizeof(WNDCLASSEX);
wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
wc.lpfnWndProc = WndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInst;
wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
wc.lpszMenuName = NULL;
wc.lpszClassName = "GLSimple";
wc.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
if(!RegisterClassEx(&wc)) {
return 0;
}
hwnd = CreateWindowEx(
NULL,
"GLSimple",
"OpenGL Simple Example",
WS_POPUP|WS_VISIBLE|WS_CLIPCHILDREN|WS_CLIPSIBLINGS,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
(HWND) NULL, (HMENU) NULL, hInst, (LPVOID) NULL);
if(hwnd == NULL) {
return 0;
}
Borderless OpenGL Window (Not fullscreen)
Simple question, and one that probably will be solved by some obscure win32 flag that I don't know. Can one create a borderless OpenGL window in Win32? I've been trying to create a window using WS_POPUP|WS_VISIBLE, but while the program shows up in the task bar but the window itself never displays. Any suggestions?
Here's my (simple simple) window creation code
Well you learn something new every day, no? Thanks for the speedy reply, that worked wonderfully! Crazy, crazy Win32...
Create the window with normal borders then do something like (Pseudo):
It's what I use to toggle between fullscreen and bordered windows.
// Get current styleslong lWS = GetWindowLong(WS) // for current WS style.long lWSEX = GetWindowLong(WS_EX) //for current WS_EX style.// Bitwise OR the flags you don't want (WS_OVERLAPPEDWINDOW etc.)lWS =| ~WS_OVERLAPPEDWINDOWlWSEX =| ~WS_EX_WHATEVERELSE // Add the flags you want.lWS =& WS_POPUPlWSEX =& WS_EX_WHATEVERELSE// Set the new styles:SetWindowLong(lWS)SetWindowLong(lWSEX)//Update windowSetWindowPos( )
It's what I use to toggle between fullscreen and bordered windows.
Smit: &= will never set bit if it already isn't there: 0101 & 0011 = 0001
You need to swap &= with |= in your post.
You need to swap &= with |= in your post.
Quote:Original post by Smit
Create the window with normal borders then do something like (Pseudo):// Get current styleslong lWS = GetWindowLong(WS) // for current WS style.long lWSEX = GetWindowLong(WS_EX) //for current WS_EX style.// Bitwise /*OR*/AND the flags you don't want (WS_OVERLAPPEDWINDOW etc.)lWS /*=|*/ &= ~WS_OVERLAPPEDWINDOWlWSEX /*=|*/ &= ~WS_EX_WHATEVERELSE // Add the flags you want.lWS /*=&*/ |= WS_POPUPlWSEX /*=&*/ |= WS_EX_WHATEVERELSE// Set the new styles:SetWindowLong(lWS)SetWindowLong(lWSEX)//Update windowSetWindowPos( )
It's what I use to toggle between fullscreen and bordered windows.
The way you had it would do the opposite.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement