Thread: installer

  1. #1
    Registered User
    Join Date
    Jun 2005


    I'm making installer (VC++ 6.0),

    I use LoadResource() to get files from install.exe, something like this

          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);
    but the install file is to big because files are not compressed.

    I tried CUnzip (from 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 ( to my project
    2) built and execute install.exe
    3) loading resource ( and write it temporarily to disk (install destination folder)
    4) unzip files from (with folder structure)
    5) delete

  2. #2
    Registered User
    Join Date
    Mar 2005
    Mountaintop, Pa
    Possibly Zlib?

  3. #3
    Registered User
    Join Date
    Jun 2005
    Quote Originally Posted by BobS0327
    Possibly Zlib?
    Yes I tried this lib... but unfortunately this is too much for me.
    Can someone show me how to use zlib in MFC.

    For example I have :

    class AppX : public CWinApp
    	BOOL InitInstance()
    	        ... ALL WINDOW STUFF
                    CString zipfile = "";
                    /// this function creates file from resource
    		CreateFileFromResource("IDR_BINFILE2", "BINFILE", zipfile);
                    CString uncomp_dest = "./Folder/Where/To/Uncompress/Files/";
                    ... HOW LOOKS THE CODE ??? UNCOMPRESS zipfile TO uncomp_dest
    		return TRUE ;
    AppX InstallFile;

  4. #4
    Registered User
    Join Date
    Jun 2005
    Finally ...
    I found ZipArchive from
    and this works

    /// szDest is CString with dest. folder from "Folder Browse Dialog"
    CString ZipTempFileName = szDest+"/temppack";
    CString UnpackFolder = szDest;
    CreateFileFromResource("IDR_BINFILE2", "BINFILE", ZipTempFileName);
    CZipArchive zip;
    zip.Open(ZipTempFileName, CZipArchive::openReadOnly); 
    for (WORD i = 0; i < zip.GetNoEntries(); i++)
    	{ zip.ExtractFile(i, UnpackFolder); }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. typical operations of an installer
    By stanlvw in forum Windows Programming
    Replies: 4
    Last Post: 05-30-2008, 08:07 AM
  2. Linux software installer recommendations
    By BobS0327 in forum Tech Board
    Replies: 13
    Last Post: 09-24-2006, 01:19 AM
  3. Visual Studio Installer Privilege Issue
    By mercury529 in forum Windows Programming
    Replies: 4
    Last Post: 01-30-2006, 01:48 PM
  4. Installer Program
    By Junior89 in forum C++ Programming
    Replies: 4
    Last Post: 01-17-2005, 01:49 AM
  5. Windows Installer Problem on XP
    By Sh0t in forum Tech Board
    Replies: 4
    Last Post: 10-14-2002, 02:11 PM