I am going through a DirectX tutorial and my title bar buttons, namely Minimize, Maximize, and Close, are missing... Here is the code that I think it would be in:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
// Create the Window Class Structure
WNDCLASSEX wc;
// Fill the Struct with Info
wc.cbSize = sizeof(WNDCLASSEX);
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = (WNDPROC)WinProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = NULL;
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
wc.lpszMenuName = NULL;
wc.lpszClassName = APPTITLE;
wc.hIconSm = NULL;
// Set Up the Window with the Class Info
return RegisterClassEx(&wc);
None of the buttons are there. I would also like a '?' Button too so I can show an "About" messagebox. What do I need to do?
// Create a New Window
hWnd = CreateWindow(
APPTITLE,
APPTITLE,
WS_OVERLAPPED,
CW_USEDEFAULT,
CW_USEDEFAULT,
SCREEN_WIDTH,
SCREEN_HEIGHT,
NULL,
NULL,
hInstance,
NULL);
I don't see any styles that specifies the close button being there, although I do see styles for the minimize and maximize buttons. Close is what I need the most. I would think the close button would show by default. Maybe it has something to do with DirectX...?
IIRC WS_SYSMENU means that 'X' button
if you change WS_OVERLAPPED to WS_OVERLAPPED_WINDOW you would have everything but the '?' button on your titlebar
Hmm... yeah it looks like it would. Though it says you can't use WS_EX_CONTEXTHELP with the maximize and minimize buttons, so you can't use it with WS_OVERLAPPEDWINDOW... But even if I make the style WS_OVERLAPPED (with no buttons at all on the title bar) or even if I make the style NULL, it still does not show the '?' like it should; it just shows nothing on the title bar.
So here's what I did next... I looked at the WS_OVERLAPPEDWINDOW style and saw that it was nothing but a style made up of these other styles...
WS_OVERLAPPED, WS_CAPTION, WS_SYSMENU, WS_THICKFRAME, WS_MINIMIZEBOX, and WS_MAXIMIZEBOX.
So instead of using WS_OVERLAPPED -or- WS_OVERLAPPEDWINDOW, I used the styles in WS_OVERLAPPEDWINDOW minus the min and max styles, so it looked like this...