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 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | #include <windows.h> LRESULT CALLBACK WindowProc( HWND Window, UINT Message, WPARAM wParam, LPARAM lParam ) { LRESULT Result = 0; switch(Message) { case WM_CREATE: { OutputDebugStringA("WM_CREATE\n"); }break; case WM_SIZE: { OutputDebugStringA("WM_SIZE\n"); }break; case WM_DESTROY: { OutputDebugStringA("WM_DESTROY\n"); }break; case WM_CLOSE: { OutputDebugStringA("WM_CLOSe\n"); }break; case WM_ACTIVATEAPP: { OutputDebugStringA("WM_ACTIVATEAPP\n"); }break; default: { OutputDebugStringA("default\n"); Result = DefWindowProc(Window, Message, wParam, lParam); }break; } return Result; } int CALLBACK WinMain(HINSTANCE Instance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow ) { WNDCLASS WindowClass = {}; //TODO: Check if CS_HREDRAW CS_OWNDC CS_VREDRAW still matters WindowClass.style = CS_OWNDC|CS_HREDRAW|CS_VREDRAW; WindowClass.lpfnWndProc; WindowClass.hInstance = Instance; //WindowClass.hIcon; WindowClass.lpszClassName = "HandmadeHeroWindowClass"; if(RegisterClass(&WindowClass)) { HWND WindowHandle = CreateWindowEx( //EROR HAPPENS HERE 0, WindowClass.lpszClassName, "Handmade Hero", WS_OVERLAPPEDWINDOW|WS_VISIBLE, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, 0, 0, Instance, 0); if(WindowHandle) { for(;;) { MSG Message; BOOL MessageResult = GetMessage(&Message, 0, 0, 0); if(MessageResult > 0) { TranslateMessage(&Message); DispatchMessage(&Message); } else { break; } } } else { //TODO: Logging } } else { //TODO: Logging } return 0; } |
1 | WindowClass.lpfnWndProc = WindowProc; |