I'm using the tutorial from www.gametutorials.com to make a simple game, i started off just a plain window with a black background but when i compile it and run it, the window doesn't show up and after a while, i ended up copying almost the entire thing from the tutorial but the window still wouldn't show up. I'm new to win32 so the mistake is probably obvious.
Code:HWND CreateMainWindow(HINSTANCE hInstance) { HWND hWnd = NULL; WNDCLASS wc; memset(&wc, 0, sizeof(WNDCLASS)); wc.hInstance = hInstance; wc.lpszClassName = "Game"; wc.lpfnWndProc = WinProc; wc.style = CS_HREDRAW | CS_VREDRAW; wc.hCursor = LoadCursor(NULL, IDC_ARROW); wc.hIcon = LoadIcon(NULL, IDI_APPLICATION); wc.lpszMenuName = NULL; wc.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH); RegisterClass(&wc); hWnd = CreateWindow("Game", "Game", WS_OVERLAPPEDWINDOW | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, CW_USEDEFAULT, CW_USEDEFAULT, 600, 600, NULL, NULL, hInstance, NULL); g_hInstance = hInstance; ShowWindow(hWnd, SW_SHOWNORMAL); UpdateWindow(hWnd); return hWnd; }every function here have been declared and definedCode:int WINAPI WinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpszargv, int ishow) { HWND hWnd = CreateMainWindow(hThisInstance); if (hWnd == NULL) return false; init(hWnd); return (int)MainLoop(); }
Also, if anyone has that tutorial, does MainLoop return a WPARAM? the return value isnt used anywhere so why not void?



LinkBack URL
About LinkBacks


