win32 window doesn't resize

Hello.

I'm having a bit of a problem with creating a win32 window: the window shows up fine, but can not be resized. Also, clicking on the minimize, maximize or close buttons does not do anything.

This is how I create the window:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
m_hWnd = nullptr;
    m_hInstance = nullptr;

    // config
    m_bytes = 8; // color bit depth


    //GLuint		PixelFormat;						// Holds The Results After Searching For A Match
	WNDCLASS	wc;							// Windows Class Structure
	DWORD		dwExStyle;						// Window Extended Style
	DWORD		dwStyle;						// Window Style
	RECT WindowRect;							// Grabs Rectangle Upper Left / Lower Right Values
	WindowRect.left=(long)0;						// Set Left Value To 0
	WindowRect.right=(long)getWindowWidth();						// Set Right Value To Requested Width
	WindowRect.top=(long)0;							// Set Top Value To 0
	WindowRect.bottom=(long)getWindowHeight();						// Set Bottom Value To Requested Height

	m_hInstance		= GetModuleHandle(nullptr);			// Grab An Instance For Our Window
	wc.style		= CS_HREDRAW | CS_VREDRAW | CS_OWNDC;		// Redraw On Move, And Own DC For Window
	wc.lpfnWndProc		= (WNDPROC) &WindowsWindow::WndProc;				// WndProc Handles Messages
	wc.cbClsExtra		= 0;						// No Extra Class Data
	wc.cbWndExtra		= 0;						// No Extra Window Data
	wc.hInstance		= m_hInstance;					// Set The Instance
	wc.hIcon		= LoadIcon(NULL, IDI_WINLOGO);			// Load The Default Icon
	wc.hCursor		= LoadCursor(NULL, IDC_ARROW);			// Load The Arrow Pointer
	wc.hbrBackground	= nullptr;						// No Background Required For GL
	wc.lpszMenuName		= nullptr;						// We Don't Want A Menu
	wc.lpszClassName	= "CWWindowsWindow";					// Set The Class Name

    if (!RegisterClass(&wc))						// Attempt To Register The Window Class
	{
		MessageBox(nullptr,"Failed To Register The Window Class.","ERROR",MB_OK|MB_ICONEXCLAMATION);
		fail();
		return;
		//return FALSE;							// Exit And Return FALSE
	}

	dwExStyle=WS_EX_APPWINDOW | WS_EX_WINDOWEDGE;	// Window Extended Style
    dwStyle=WS_OVERLAPPEDWINDOW;					// Windows Style

    AdjustWindowRectEx(&WindowRect, dwStyle, FALSE, dwExStyle);		// Adjust Window To True Requested Size

    if (!(m_hWnd = CreateWindowEx(	dwExStyle,				// Extended Style For The Window
					"CWWindowsWindow\0",				// Class Name
					"CW\0",					// Window Title
					WS_CLIPSIBLINGS |			// Required Window Style
					WS_CLIPCHILDREN |			// Required Window Style
					dwStyle,				// Selected Window Style
					0, 0,					// Window Position
					WindowRect.right-WindowRect.left,	// Calculate Adjusted Window Width
					WindowRect.bottom-WindowRect.top,	// Calculate Adjusted Window Height
					nullptr,					// No Parent Window
					nullptr,					// No Menu
					m_hInstance,				// Instance
					this)))					// Pass self to WM_CREATE
	{
		
		MessageBox(nullptr,"Window Creation Error.\0","ERROR\0",MB_OK|MB_ICONEXCLAMATION);
		fail();
		return;
	}

	ShowWindow(m_hWnd,SW_SHOW);
	SetForegroundWindow(m_hWnd);
	SetFocus(m_hWnd);
	UpdateWindow(m_hWnd);

My message pump looks like this:
1
2
3
4
5
6
7
//message handling
    while(PeekMessage(&m_msg,nullptr,0,0,PM_REMOVE))
    {
        TranslateMessage(&m_msg);
        DispatchMessage(&m_msg);
    }

How can I get my window to resize?
Last edited on
In my wndproc, I handle WM_SIZE messages like this:

1
2
3
4
5
6
7
case WM_SIZE:							// Resize The OpenGL Window
		{
            // LoWord=Width, HiWord=Height
            ctxptr->getEventHandler()->queueEvent(new WindowResizeTriggeredEvent(LOWORD(lParam), HIWORD(lParam)));

			return DefWindowProc(p_hWnd,uMsg,wParam,lParam);						// Jump Back
		}


I still can not resize the window.
Last edited on
Registered users can post here. Sign in or register to post.