Resize Window

Alright, so I'm trying to make it so when you press space it will resize the current Window.

But when I press 'space' it creates a new Window on top of the old Window instead.

Resize Window
1
2
3
4
5
void Engine::WindowSize(int width, int height)
{
	WinW = width;
	WinH = height;
}


Draws Window
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
bool Engine::WindowDraw()
{
	eWnd = CreateWindow(szWindowClass, LPCWSTR(WinCap), button, CW_USEDEFAULT, CW_USEDEFAULT, WinW, WinH, NULL,NULL,eInstance, NULL);

	if (!eWnd)
	{
		::MessageBoxA(NULL, "Error: CreateWindow failed!", "Error", MB_OK | MB_ICONERROR);
		return false;
	}

	ShowWindow(eWnd, eCmdShow);
	UpdateWindow(eWnd);

	return true;
}


Space
1
2
3
4
5
6
7
8
while (engine->MainLoop())
	{
		if (GetAsyncKeyState(VK_SPACE))
		{
			engine->WindowSize(400, 200);
			engine->WindowDraw();
		}
	}
Last edited on
Alright, the problem is on line 24 of your source code.
Last edited on
Haha good point, completely forgot about that.. 2 secs
Kinda figured it out, used SetWindowPos to do it.
Last edited on
Topic archived. No new replies allowed.