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
|
HINSTANCE hInstance;
WND splash_window, main_window;
MSG msg;
LRESULT CALLBACK main_proc(HWND, UINT, WPARAM, LPARAM);
LRESULT CALLBACK splash_proc(HWND, UINT, WPARAM, LPARAM);
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpCmd, int nCmd) {
start_main_window(hInst, lpCmd, nCmd);
while (GetMessage(&msg, NULL, 0, 0) > 0) {
if ((!IsDialogMessage(main_window, &msg))) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
// Why should I remove the messages loop???
return (int) msg.wParam;
}
int start_main_window(HINSTANCE hInst, LPSTR lpCmd, int nCmd) {
WNDCLASSEX wcex;
wcex.cbSize = sizeof(WNDCLASSEX);
wcex.style = CS_HREDRAW | CS_VREDRAW;
wcex.lpfnWndProc = main_proc;
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 0;
.
.
.
// Create it but don't ShowWindow yet
}
LRESULT CALLBACK main_proc(HWND, UINT, WPARAM, LPARAM) {
case WM_CREATE:
//Create splash window and all its elements here
break;
case WM_COMMAND:
//When user clicks on a Continue button the splash_window is destroyed
//and the main_window is destroyed
break;
//Anything else
}
LRESULT CALLBACK splash_proc(HWND, UINT, WPARAM, LPARAM) {
case WM_COMMAND:
//When user clicks on a Continue button the splash_window is destroyed
//and the main_window is destroyed
break;
//Anything else
}
|