Changeset 535
- Timestamp:
- 11/13/2008 9:56:14 AM (3 years ago)
- Location:
- branches/eraser6/Installer/Bootstrapper
- Files:
-
- 3 edited
-
Bootstrapper.cpp (modified) (4 diffs)
-
Bootstrapper.h (modified) (1 diff)
-
Main.cpp (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eraser6/Installer/Bootstrapper/Bootstrapper.cpp
r534 r535 35 35 InStream.Seek = LzFileStreamSeek; 36 36 FileHandle = fileHandle; 37 38 FileRead = FileRead = 0; 39 LARGE_INTEGER largeInt; 40 largeInt.QuadPart = 0; 41 if (!SetFilePointerEx(FileHandle, largeInt, &largeInt, FILE_CURRENT)) 42 throw GetErrorMessage(GetLastError()); 43 44 long long currPos = largeInt.QuadPart; 45 largeInt.QuadPart = 0; 46 if (!SetFilePointerEx(FileHandle, largeInt, &largeInt, FILE_END)) 47 throw GetErrorMessage(GetLastError()); 48 FileSize = largeInt.QuadPart - currPos; 49 50 largeInt.QuadPart = currPos; 51 if (!SetFilePointerEx(FileHandle, largeInt, NULL, FILE_BEGIN)) 52 throw GetErrorMessage(GetLastError()); 37 53 } 38 54 … … 43 59 44 60 ISzInStream InStream; 61 62 private: 45 63 HANDLE FileHandle; 46 47 private: 64 long long FileRead; 65 long long FileSize; 66 48 67 static SZ_RESULT LZFileStreamRead(void* object, void** bufferPtr, size_t size, 49 68 size_t* processedSize) … … 61 80 *bufferPtr = buffer; 62 81 *processedSize = readSize; 82 s->FileRead += readSize; 83 84 SetProgress((double)s->FileRead / s->FileSize); 63 85 } 64 86 … … 128 150 unsigned blockIndex = 0; 129 151 Byte* outBuffer = NULL; 130 size_t outBufferSize = 0;152 size_t outBufferSize = 524288; 131 153 for (unsigned i = 0; i < db.Database.NumFiles; ++i) 132 154 { -
branches/eraser6/Installer/Bootstrapper/Bootstrapper.h
r534 r535 37 37 HWND GetTopWindow(); 38 38 39 void SetProgress(float progress); 40 void SetProgressIndeterminate(); 41 void SetMessage(std::wstring message); 42 39 43 /// Retrieves the path to the executable file. 40 44 std::wstring GetApplicationPath(); -
branches/eraser6/Installer/Bootstrapper/Main.cpp
r533 r535 38 38 HINSTANCE hInstance = NULL; 39 39 HWND hWndParent = NULL; 40 HWND hWndStatusLbl = NULL; 41 HWND hWndProgressBar = NULL; 42 HWND hWndCancelBtn = NULL; 40 43 41 44 bool InitInstance(HINSTANCE hInstance, HWND& hWnd); … … 60 63 ~TempDir() 61 64 { 65 //TODO: remove files in the directory. 62 66 RemoveDirectoryW(DirName.c_str()); 63 67 } … … 111 115 if ( !::SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, &ncm, 0) ) 112 116 { 113 #if WINVER >= 0x0600117 #if WINVER >= 0x0600 114 118 // a new field has been added to NONCLIENTMETRICS under Vista, so 115 119 // the call to SystemParametersInfo() fails if we use the struct … … 118 122 ncm.cbSize -= sizeof(int); 119 123 if ( !::SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, &ncm, 0) ) 120 #endif124 #endif 121 125 return; 122 126 } … … 181 185 HWND hWndPanel = CreateWindowExW(0, STATIC_CLASS, NULL, WS_CHILD | WS_VISIBLE, 182 186 0, 0, 294, 104, hWndParent, NULL, hInstance, NULL); 183 HWNDhWndStatusLbl = CreateWindowExW(0, STATIC_CLASS, L"Extracting setup files...",187 hWndStatusLbl = CreateWindowExW(0, STATIC_CLASS, L"Extracting setup files...", 184 188 WS_CHILD | WS_VISIBLE, 13, 38, 270, 19, hWndPanel, NULL, hInstance, NULL); 185 HWND hWndProgressBar = CreateWindowExW(0, PROGRESS_CLASS, NULL, 186 WS_CHILD | WS_VISIBLE, 13, 13, 270, 24, hWndPanel, NULL, hInstance, NULL); 187 HWND hWndCancelBtn = CreateWindowExW(0, BUTTON_CLASS, L"Cancel", WS_TABSTOP | 189 hWndProgressBar = CreateWindowExW(0, PROGRESS_CLASS, NULL, 190 WS_CHILD | WS_VISIBLE | PBS_SMOOTH, 13, 13, 270, 24, hWndPanel, NULL, 191 hInstance, NULL); 192 hWndCancelBtn = CreateWindowExW(0, BUTTON_CLASS, L"Cancel", WS_TABSTOP | 188 193 WS_CHILD | WS_VISIBLE | BS_DEFPUSHBUTTON, 193, 65, 90, 23, hWndPanel, NULL, 189 194 hInstance, NULL); … … 195 200 SetWindowFont(hWndProgressBar); 196 201 SetWindowFont(hWndCancelBtn); 202 SendMessage(hWndProgressBar, PBM_SETRANGE, 0, MAKELPARAM(0, 1000)); 197 203 198 204 ShowWindow(hWndParent, nCmdShow); … … 228 234 } 229 235 236 void SetProgress(float progress) 237 { 238 SetWindowLong(hWndProgressBar, GWL_STYLE, 239 GetWindowLong(hWndProgressBar, GWL_STYLE) & (~PBS_MARQUEE)); 240 SendMessage(hWndProgressBar, PBM_SETPOS, (int)(progress * 1000), 0); 241 } 242 243 void SetProgressIndeterminate() 244 { 245 SetWindowLong(hWndProgressBar, GWL_STYLE, 246 GetWindowLong(hWndProgressBar, GWL_STYLE) | PBS_MARQUEE); 247 SendMessage(hWndProgressBar, PBM_SETMARQUEE, true, 100); 248 } 249 250 void SetMessage(std::wstring message) 251 { 252 } 253 230 254 void Yield() 231 255 {
Note: See TracChangeset
for help on using the changeset viewer.
