Zvjezdan23 -13 Junior Poster

This is code for generating a blank window for direct X. When I build this code i get the errors..

'Chapter1_DirectXWindow.exe': Loaded 'C:\WINDOWS\System32\uxtheme.dll', Cannot find or open the PDB file

The program '[2536] Chapter1_DirectXWindow.exe: Native' has exited with code -1 (0xffffffff).

The code is successful. Can someone please check it out for me?

#include <Windows.h>

LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lparam)
{
	PAINTSTRUCT paintStruct;
	HDC hDC;

	switch(message)
	{

	case WM_PAINT:
		hDC = BeginPaint(hwnd, &paintStruct);
		EndPaint(hwnd, &paintStruct);
		break;

	case WM_DESTROY:
		PostQuitMessage(0);
		break;

	default:
		return DefWindowProc(hwnd, message, wParam, lparam);
	}

	return 0;
}


int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE prevInstance, LPWSTR cmdLine, int cmdShow)
{
	UNREFERENCED_PARAMETER(prevInstance); // helps make 0 warnings and is great coding practice
	UNREFERENCED_PARAMETER(cmdLine);

	WNDCLASSEX wndClass = {0};
	wndClass.cbSize = sizeof(WNDCLASSEX);
	wndClass.style = CS_HREDRAW | CS_VREDRAW;
	wndClass.lpfnWndProc = WndProc;
	wndClass.hInstance = hInstance;
	wndClass.hCursor = LoadCursor(NULL, IDC_ARROW);
	wndClass.hbrBackground = (HBRUSH) (COLOR_WINDOW +1);
	wndClass.lpszMenuName = NULL;
	wndClass.lpszClassName = "DirectX Window Class";

	if (!RegisterClassEx(&wndClass))
		return -1;

	RECT rc = {0, 0, 640, 480};
	AdjustWindowRect(&rc, WS_OVERLAPPEDWINDOW, FALSE);

	HWND hwnd = CreateWindowA("Direct X Window Class", "Blank Window32 Window", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, rc.right - rc.left, rc.bottom - rc.top, NULL, NULL, hInstance, NULL);
	
	if(!hwnd)
		return -1;

	ShowWindow(hwnd, cmdShow);

	MSG msg = {0};

	while(msg.message != WM_QUIT)
	{
		if(PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
		{
			TranslateMessage(&msg);
			DispatchMessage(&msg);
		}
	}

	system("pause");
	return static_cast<int>(msg.wParam);
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.