tags:

views:

96

answers:

4

Hi, I am making an application which uses a separate program to unzip some files. How can I compile my exe to contain the unzipping exe inside so that I only have one file instead of two.

A: 

The normal way to do this would be to have a setup program that contains and installs both files.

Or do you actually need to have only one executable after it has been installed? If so I'm not sure if there is an easy solution for VB6, the .Net framework contains functionality for unzipping files so you might be able to use that, but I don't think there's anything similar in VB6.

ho1
I don't want a setup and the unzipping would actually be untarring so I don't think so... I need to have 1 exe which is actually two.
Neb
+2  A: 

A possible solution might be to create a program that appends your unzipping exe to the main executable and writes a tag or records the offset where the unzipping exe starts. Then in the main executable at run time you can read the data, write it to a temporary file, and launch it. I've done this with image and sound data for a 'customizable' screensaver before, it can probably be done in VB as well.

see this answer to a similar question for a nice algorithm on how to accomplish this.

A: 

Use an untar library, build it into your app at compile / link, and deploy the exe. zsharplib is one option for .NET. I've used vb6 unzip libraries before, but don't recall the name.

reuscam
Isn't zsharplib for c#?
Neb
Yes, I mentioned its for .NET as an example.
reuscam
+1  A: 

This is actually pretty awful, it is preferable to use a setup.

However, if you insist... you might bundle your two EXEs using IExpress (included in Windows since XP, before that get it from the IEAK), and set your "main program" as the "Install Program to Launch."

This will produce a single EXE as its output. When run it will extract the packaged files into a temp folder and run your "main" EXE.

Start|Run... and enter IExpress to start the wizard.

BTW: This is also a nice way to package up the files the PDW creates into a single installation EXE.

Bob Riemersma