I'm making installer (VC++ 6.0),
I use LoadResource() to get files from install.exe, something like this
but the install file is to big because files are not compressed.Code:HINSTANCE hInst = AfxGetInstanceHandle(); HRSRC hmdbFile = ::FindResource(hInst, ResName, ResType); HGLOBAL hRes = ::LoadResource(hInst, hmdbFile); DWORD dwResSize = ::SizeofResource(hInst, hmdbFile); UINT FAR* lpnRes = (UINT FAR*)::LockResource(hRes); CString szFileName = FileName; CFile f( szFileName, CFile::modeCreate | CFile::modeWrite ); f.WriteHuge(lpnRes, dwResSize); f.Flush(); ...
I tried CUnzip (from http://www.codeguru.com/cpp/cpp/cpp_...icle.php/c819/) to unzip files, but this library dose not support folders... it means I still have to write my programs folder structure in code and make resources to all files.
Is there available any better unzip (or another format: rar, ace ... ) library?
Or another solution to make install.exe (I dont want to use InstallShield or any another app), my solution is:
1) add resource (file.zip) to my project
2) built and execute install.exe
3) loading resource (file.zip) and write it temporarily to disk (install destination folder)
4) unzip files from file.zip (with folder structure)
5) delete file.zip