1.1 --- a/tools/installer/InstallerMain.cpp Fri Jul 11 06:51:21 2008 +0000
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,142 +0,0 @@
1.4 -#include "InstallerMain.h"
1.5 -#include "Welcome.h"
1.6 -
1.7 -#define WMU_INIT_INSTALLER WM_USER+1
1.8 -
1.9 -HINSTANCE g_hInstance;
1.10 -NEXT_DIALOG next_dialog = DisplayWelcome;
1.11 -POINT g_GlobalPosition;
1.12 -
1.13 -void UpdateGlobalPosition(HWND hWnd)
1.14 -{
1.15 - WINDOWINFO wi;
1.16 -
1.17 - wi.cbSize = sizeof(WINDOWINFO);
1.18 - if (GetWindowInfo(hWnd, &wi))
1.19 - {
1.20 - g_GlobalPosition.x = wi.rcWindow.left;
1.21 - g_GlobalPosition.y = wi.rcWindow.top;
1.22 - }
1.23 -}
1.24 -
1.25 -void SetToGlobalPosition(HWND hWnd)
1.26 -{
1.27 - WINDOWINFO wi;
1.28 -
1.29 - wi.cbSize = sizeof(WINDOWINFO);
1.30 - if (GetWindowInfo(hWnd, &wi))
1.31 - {
1.32 - MoveWindow(hWnd,
1.33 - g_GlobalPosition.x,
1.34 - g_GlobalPosition.y,
1.35 - wi.rcWindow.right - wi.rcWindow.left,
1.36 - wi.rcWindow.bottom - wi.rcWindow.top,
1.37 - TRUE);
1.38 - }
1.39 -}
1.40 -
1.41 -LRESULT CALLBACK MainWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
1.42 -{
1.43 - switch (message)
1.44 - {
1.45 - case WMU_INIT_INSTALLER:
1.46 - {
1.47 - UpdateGlobalPosition(hWnd);
1.48 - while (next_dialog != NULL)
1.49 - {
1.50 - next_dialog = (NEXT_DIALOG)next_dialog(hWnd);
1.51 - }
1.52 - PostQuitMessage(0);
1.53 - break;
1.54 - }
1.55 - case WM_DESTROY:
1.56 - {
1.57 - PostQuitMessage(0);
1.58 - break;
1.59 - }
1.60 - default:
1.61 - {
1.62 - return DefWindowProc(hWnd, message, wParam, lParam);
1.63 - }
1.64 - }
1.65 -
1.66 - return 0;
1.67 -}
1.68 -
1.69 -int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
1.70 -{
1.71 - WNDCLASSEX wcex;
1.72 - BOOL bRet;
1.73 -
1.74 - wcex.cbSize = sizeof(wcex);
1.75 - wcex.style = CS_HREDRAW | CS_VREDRAW;
1.76 - wcex.lpfnWndProc = MainWndProc;
1.77 - wcex.cbClsExtra = 0;
1.78 - wcex.cbWndExtra = 0;
1.79 - wcex.hInstance = hInstance;
1.80 - wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_INSTALLER));
1.81 - wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
1.82 - wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
1.83 - wcex.lpszMenuName = _T("InstallerMenu");
1.84 - wcex.lpszClassName = _T("Installer");
1.85 - wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL));
1.86 -
1.87 - if (!RegisterClassEx(&wcex))
1.88 - {
1.89 - return 1;
1.90 - }
1.91 -
1.92 - INITCOMMONCONTROLSEX ccex;
1.93 - ccex.dwSize = sizeof(ccex);
1.94 - ccex.dwICC = ICC_BAR_CLASSES
1.95 - |ICC_HOTKEY_CLASS
1.96 - |ICC_LISTVIEW_CLASSES
1.97 - |ICC_PROGRESS_CLASS
1.98 - |ICC_WIN95_CLASSES
1.99 - |ICC_TAB_CLASSES;
1.100 -
1.101 - if (!InitCommonControlsEx(&ccex))
1.102 - {
1.103 - return 1;
1.104 - }
1.105 -
1.106 - g_hInstance = hInstance;
1.107 -
1.108 - HWND hWnd = CreateWindow(
1.109 - _T("Installer"),
1.110 - _T("InstallerMain"),
1.111 - WS_OVERLAPPEDWINDOW,
1.112 - CW_USEDEFAULT,
1.113 - CW_USEDEFAULT,
1.114 - CW_USEDEFAULT,
1.115 - CW_USEDEFAULT,
1.116 - (HWND)NULL,
1.117 - (HMENU)NULL,
1.118 - hInstance,
1.119 - NULL);
1.120 - if (hWnd == NULL)
1.121 - {
1.122 - return 1;
1.123 - }
1.124 -
1.125 - ShowWindow(hWnd, SW_HIDE);
1.126 - UpdateWindow(hWnd);
1.127 -
1.128 - PostMessage(hWnd, WMU_INIT_INSTALLER, 0, 0);
1.129 -
1.130 - MSG msg;
1.131 - while ((bRet = GetMessage(&msg, NULL, 0, 0)) != 0)
1.132 - {
1.133 - if (bRet == -1)
1.134 - {
1.135 - return 1;
1.136 - }
1.137 - else
1.138 - {
1.139 - TranslateMessage(&msg);
1.140 - DispatchMessage(&msg);
1.141 - }
1.142 - }
1.143 -
1.144 - return (int)msg.wParam;
1.145 -}