3 Part of the swftools installer (Main program).
5 Copyright (c) 2004 Matthias Kramm <kramm@quiss.org>
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
27 #include "../config.h" //for swftools version
31 LRESULT CALLBACK WindowFunc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
33 printf("%08x, %d %08x %08x\n", hwnd, message, wParam, lParam);
40 return DefWindowProc(hwnd, message, wParam, lParam);
46 static HANDLE console;
48 static char*lastmessage = 0;
49 void myarchivestatus(int type, char*text)
54 WriteConsole(console, text, strlen(text), &written, 0);
55 WriteConsole(console, "\n", 1, &written, 0);
65 int ret = MessageBox(0, text, "Error", MB_RETRYCANCEL|MB_ICONERROR);
67 /* there is no MB_CANCEL, so, *sigh*, we have to display
68 the "retry" button. So pretend it's doing anything... */
77 int WINAPI WinMain(HINSTANCE me,HINSTANCE hPrevInst,LPSTR lpszArgs, int nWinMode)
80 char*install_dir = "C:\\swftools\\";
83 wcl.lpszClassName= "SWFTools-Installer";
84 wcl.lpfnWndProc = WindowFunc;
85 wcl.style = 0; //default style
86 wcl.hIcon = LoadIcon (NULL, IDI_APPLICATION);
87 wcl.hCursor = LoadCursor(NULL, IDC_ARROW);
88 wcl.lpszMenuName = NULL; //no menu
91 wcl.hbrBackground=(HBRUSH)GetStockObject(DKGRAY_BRUSH);
93 if(!RegisterClass(&wcl))
101 sprintf(buf, "Do you want me to install SWFTools into the directory %s now?", install_dir);
102 int ret = MessageBox(0, buf, "SWFTools Install", MB_YESNO|MB_ICONQUESTION);
110 console = GetStdHandle(STD_OUTPUT_HANDLE);
111 WriteConsole(console, "\r\n", 1, &written, 0);
115 int success = unpack_archive(crndata, "C:\\swftools\\", myarchivestatus);
122 sprintf(buf, "SWFTools Version %s has been installed into %s successfully", VERSION, install_dir);
123 ret = MessageBox(0, buf, "SWFTools Install", MB_OK|MB_ICONINFORMATION);
125 /*sprintf(buf, "Installation failed\nLast message: %s", lastmessage);
126 ret = MessageBox(0, buf, "SWFTools Install", MB_OK|MB_ICONERROR);*/