Changeset 16079 for release-kits/wirk2/wrapper/wrapper.cpp
- Timestamp:
- 2008-06-20T10:00:57+12:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
release-kits/wirk2/wrapper/wrapper.cpp
r15813 r16079 14 14 //globals 15 15 HBITMAP g_splash = NULL; //the main splash bitmap 16 HFONT g_hfFont = NULL; //the main splash bitmap 16 17 char step[10] = "TMP"; //the current step 17 18 char progress[4] = "0"; //progress in the current step … … 45 46 46 47 //extracts a resource in chunks 47 int extractResource( const char * basename, const char * type, char * file , int no_chunks) {48 int extractResource( const char * basename, const char * type, char * file ) { 48 49 49 50 HMODULE hModule = GetModuleHandle(NULL); 50 51 set_splash_progress( 0 ); 51 52 53 int no_chunks; 54 bool chunk_available = true; 55 for ( no_chunks = 0; chunk_available; no_chunks++ ) { 56 57 //construct the chunk name 58 char chunkname[127] = {0}; 59 strcpy( chunkname, basename ); 60 strcat( chunkname, "_" ); 61 char chunknum[5] = {0}; 62 itoa( no_chunks+1, chunknum, 10 ); 63 strcat( chunkname, chunknum ); 64 65 if ( FindResource(hModule, chunkname, type) == NULL ) { 66 chunk_available = false; 67 } 68 } 69 52 70 for ( int i=0; i<no_chunks; i++ ) { 53 71 54 72 //construct the chunk name 55 73 char chunkname[127] = {0}; … … 60 78 strcat( chunkname, chunknum ); 61 79 62 //MessageBox(NULL, chunkname, "chunk name", MB_OK); 63 64 //try to find it 80 //find it 65 81 HRSRC hRsrc = FindResource(hModule, chunkname, type); 66 if (hRsrc == NULL ) return -1; //couldn't find the chunk82 if (hRsrc == NULL ) return 1; //couldn't find the chunk 67 83 68 84 //load it 69 85 HGLOBAL hGlobal = LoadResource(hModule, hRsrc); 70 86 if (hGlobal == NULL) return 1; //couldn't lock 87 88 //lock it 71 89 BYTE* pBytes = (BYTE*) LockResource(hGlobal); 72 90 if (pBytes == NULL) return 1; //couldn't lock … … 98 116 //load in the reusable resources 99 117 g_splash = LoadBitmap(GetModuleHandle(NULL),"SPLASH"); 118 g_hfFont = (HFONT)GetStockObject(DEFAULT_GUI_FONT); 100 119 if(g_splash == NULL) { 101 120 MessageBox(hwnd, "Could not load splash bitmap!", "Error", MB_OK | MB_ICONEXCLAMATION); … … 146 165 SelectObject(hdcMem, g_step); 147 166 BitBlt(hdc, 0, 276, bm.bmWidth, bm.bmHeight, hdcMem, 0, 0, SRCPAINT); 167 168 //print the step with text 169 RECT rcClient; 170 GetClientRect(hwnd, &rcClient); 171 //DrawText(hdc, "This is the step", -1, &rcClient, DT_SINGLELINE | DT_CENTER | DT_VCENTER); 148 172 149 173 //restore the hdc … … 294 318 //is this an installer with the bundled JRE? 295 319 set_splash_step( "XJAVA" ); 296 int extract_result = extractResource( "JAVA", "EXE", "@java.installer@" , 2);320 int extract_result = extractResource( "JAVA", "EXE", "@java.installer@" ); 297 321 298 322 if ( extract_result == 0 ) { … … 327 351 328 352 set_splash_step( "XJAR" ); 329 extractResource( "JAR", "JAR", (char*) jarLocation.c_str() , 12);353 extractResource( "JAR", "JAR", (char*) jarLocation.c_str() ); 330 354 331 355 //launch the jar
Note:
See TracChangeset
for help on using the changeset viewer.