1 #include "InstallerMain.h"
4 #define WMU_INIT_INSTALLER WM_USER+1
7 NEXT_DIALOG next_dialog = DisplayWelcome;
8 POINT g_GlobalPosition;
10 void UpdateGlobalPosition(HWND hWnd)
14 wi.cbSize = sizeof(WINDOWINFO);
15 if (GetWindowInfo(hWnd, &wi))
17 g_GlobalPosition.x = wi.rcWindow.left;
18 g_GlobalPosition.y = wi.rcWindow.top;
22 void SetToGlobalPosition(HWND hWnd)
26 wi.cbSize = sizeof(WINDOWINFO);
27 if (GetWindowInfo(hWnd, &wi))
32 wi.rcWindow.right - wi.rcWindow.left,
33 wi.rcWindow.bottom - wi.rcWindow.top,
38 LRESULT CALLBACK MainWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
42 case WMU_INIT_INSTALLER:
44 UpdateGlobalPosition(hWnd);
45 while (next_dialog != NULL)
47 next_dialog = (NEXT_DIALOG)next_dialog(hWnd);
59 return DefWindowProc(hWnd, message, wParam, lParam);
66 int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
71 wcex.cbSize = sizeof(wcex);
72 wcex.style = CS_HREDRAW | CS_VREDRAW;
73 wcex.lpfnWndProc = MainWndProc;
76 wcex.hInstance = hInstance;
77 wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_INSTALLER));
78 wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
79 wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
80 wcex.lpszMenuName = _T("InstallerMenu");
81 wcex.lpszClassName = _T("Installer");
82 wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL));
84 if (!RegisterClassEx(&wcex))
89 INITCOMMONCONTROLSEX ccex;
90 ccex.dwSize = sizeof(ccex);
91 ccex.dwICC = ICC_BAR_CLASSES
98 if (!InitCommonControlsEx(&ccex))
103 g_hInstance = hInstance;
105 HWND hWnd = CreateWindow(
122 ShowWindow(hWnd, SW_HIDE);
125 PostMessage(hWnd, WMU_INIT_INSTALLER, 0, 0);
128 while ((bRet = GetMessage(&msg, NULL, 0, 0)) != 0)
136 TranslateMessage(&msg);
137 DispatchMessage(&msg);
141 return (int)msg.wParam;