Ok, the CPU usage thing seems to have been mostly solved (I added a Sleep(1) and my CPU usage has been halved). As for the handling the close message, I have this code:

Code:
LRESULT CALLBACK WndProc(HWND hwnd,UINT msg,WPARAM wparam,LPARAM lparam)
{
	switch(msg)
	{
		case WM_CLOSE:
			DestroyWindow(hwnd);
		case WM_DESTROY:
			PostQuitMessage(0);
			break;
		default:
			break;
	}
	return DefWindowProc(hwnd,msg,wparam,lparam);
}


I know basic Win32 (I'm up to doing GDI stuff), I'm just new to DirectX. I don't know why my messages aren't being handled correctly. Usually when I'm writing a normal Win32 program, I don't really even need the WM_CLOSE/DestroyWindow() handler. I can just use WM_DESTROY.

EDIT: ok, CPU usage thing must have been a strange coincidence, because it's still at 100%. Well, Sleep(10) makes it lower, but I'm afraid that might make the rendering FPS (for when I start doing more with 3D) drop quite a bit.

Last edited by MrCode; 09/07/08 17:16. Reason: CPU usage still problem, and more wait time could be not good

Code:
void main()
{
    cout << "I am MrCode,";
    cout << "hear me roar!";
    system("PAUSE");
}