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
|
#include "Main.hpp"
LRESULT CALLBACK WinProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
INT CALLBACK _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPCTSTR lpCmdLine, INT nCmdShow){
const TCHAR* CLASS_NAME = TEXT("Window Title Text");
WNDCLASS wc = {0, WinProc, 0, 0, hInstance, NULL, LoadCursor(NULL, IDC_ARROW), NULL, NULL, CLASS_NAME};
RegisterClass(&wc);
HWND hWnd;
{
RECT rec = {0, 0, 800, 600};
AdjustWindowRect(&rec, WS_OVERLAPPEDWINDOW, false);
hWnd = CreateWindowEx(NULL, CLASS_NAME, CLASS_NAME, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, rec.right - rec.left, rec.top - rec.bottom, NULL, NULL, hInstance, NULL);
}
if(!hWnd){
MessageBox(NULL, TEXT("CreateWindowEx() returned NULL handle\nApplication will terminate"), TEXT("Failed"), MB_ICONERROR | MB_OK);
return GetLastError();
}
ShowWindow(hWnd, nCmdShow);
MSG msg;
while(GetMessage(&msg, NULL, 0, 0)){
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return 0;
}
LRESULT CALLBACK WinProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam){
//You know the drill here, but it's not relevant to the problem
}
|