Link to home
Start Free TrialLog in
Avatar of USHASHI
USHASHI

asked on

Self Extracting exe

My VB application should extract an exe which contains list of files
( .gif, .jpeg, shockwave etc.) and store the extracted files in a folder.
Expecting Answer at the earliest.
Thank You
Avatar of Vbmaster
Vbmaster

You can add any binary data to a resource file and at run-time you can extract that data and save it to disk.
I found the resource editor I use, it's at

http://www.planetwide.co.uk/vbaddins.htm

It's a VB addin so you will have to install it and activate it in the Addin Manager, but when you have done that it's a peace of cake, really.

You will get a new button in the toolbar push it and add all the files you wanna add, then save it (important! because there is NO autosave). You can load custom data using

  Dim ByteArray() As Byte
 
  ByteArray = LoadResData(101, "CUSTOM")
  Open testfilename For Binary As #1
  Put #1, , ByteArray
  Close #1

Check the helpfile for loading resource bitmaps.
a problem will arise from using Resources - ithink.
RES files are limited as how big files can be - 64k is the maximum. So if you planning to put big stuff in them - think again.

I recommand StructuredStrorage - checkout - www.desaware.com and look at their StorageTools component.


hope this helps,

regards,

thanks
And if you want to do it without paying $149.00 you can use you head and split the big files (if you have any) into 64kb chunks. When you are to save the files to data, just read chunk by chunk and append to the files. Is that kinda hard labour really worth $149? ;)
Alternately use PKUNZIP...

M
Avatar of USHASHI

ASKER

Reseditl.exe in http://www.planetwide.co.uk/vbaddins.htm
is for VB5. I am working in vb6.
  So, I added files using resource editor available in vb Application wizard and I used vbMaster's 4 lines code. It works fine. But this will help if U'r adding resources statically. I have 2 problems in this.
1.I want to add resources dynamically.
 Is it possible?
2. When using LoadResData(101,"CUSTOM") the type of file is not known. Is there any way to know the file type. (FOr ex. whether 101 id denotes
to .gif, .jpeg, .avi etc.) It will be nice if I can have the full filename too.
Thank You,  
 

Try this link:

WinZip Self-Extractor 2.1
http://www.winzip.com/winzipse.htm?wzt 
 
With winzip self-extractor, you can build a zip file and have the self-extractor extract the zip file and actually run a program after the extraction is complete.

There are 2 methods WinZip uses...

Build a self-extractor for software installation, and self-extractor only...

There is a FREE demo of the product at the site I gave you, and if you want to register it, it's only about $49.


If you use this solution please select this comment as the solution...



Cheers!
I don't think it's possible to change the resources dynamically during run-time because it's a part of the exe file that is running, and no changes can be made of a running file.

A solution for 2. would be to store the filenames and perhaps the filetype too as a string and use LoadResString to load it (use the same index that way you know that 101 in LoadResData has the 'definition' in 101 in LoadResString.).

If you want to change the data dynamically then resource files are not the way to go, you can save the files on disk in the program directory and read from there instead (you can use ZLib compressions if you want to add compression for free).
Avatar of USHASHI

ASKER

The winzip self extractor is a stand alone application. The files to be zipped are to be selected from the vbaplication itself. Could you please tell me if winzip has any distribution dll's so that i can add thro' reference and use. And I also would like to know about Zlib compressions which vbmaster has mentioned.
Thank You,
Avatar of USHASHI

ASKER

The winzip self extractor is a stand alone application. The files to be zipped are to be selected from the vbaplication itself. Could you please tell me if winzip has any distribution dll's so that i can add thro' reference and use. And I also would like to know about Zlib compressions which vbmaster has mentioned.
Thank You,
You can get a copy of PKZIP/PKUNZIP for free from PKWARE.COM. It includes ZIP2EXE which will convert a .ZIP into a .EXE. Once you have the .EXE you can use the command line switches to tell it what and how to extract. No .DLL's needed. Simply use SHELL to pull out whatever you need. If you need your app to *wait* for the extraction to complete use the ExecCmd (Source code on my web page - www.cyberchute.com/rvbus/madmark ) instead of SHELL.

M
The official homepage of the ZLib compression is at..

   http://www.cdrom.com/pub/infozip/zlib/

You will need a 52kb DLL file, and I have made a class file (that is really easy to use) as a wrapper around the functionality, you can find the dll and cls file at..

  http://www.cyd.liu.se/~freqv416/zlib/

You can compress byte arrays using the class just remember that you need to store the actual size (size before compression) because when you uncompress the dll needs the size of the uncompressed data. The class members parameter says it all I think.
http://www.geocities.com/SiliconValley/Foothills/9940/

At the site that i provided an address for above, you can find a typelib that you can use for structured storage files. Just look at the typelibs section when you get there and download the "Storage Interfaces" file. It says "read and write office documents" but it should work with whatever format you want.
Sorry for the double post, there was some kind of error in my browser when I posted it.
I forgot to say this in my last posting, if you visit the source code area there you can find an example of how to use the typelib.
I use IExpress from the IEAK to create all of my self extracting .exe's..  the order of operations is this (for me anyway) use P&D wizard to create the setup, then use IExpress to roll them all up into a self extracting .exe
Avatar of USHASHI

ASKER

MCRIDER & MARK2150 ANSWERS HAS WORKED. CALLING WINZIP SELF EXTRACTOR FROM SHELL PROVED TO BE A GOOD SOLUTION.
THANK YOU.
and the points go to...?

(grin)

M
Well, I mentioned the WinZip Self-Extractor and where to get it... mark2150 suggested PKZIP...

Cheers!
Avatar of USHASHI

ASKER

50 points to mcrider and 25 to mark2150
USHASHI,

To split points, you need to open two new questions with the titles "For MCRIDER ONLY" and "For MARK2150 ONLY".

Assign the points to the questions and then go to https://www.experts-exchange.com/Customer_Service/Experts_Exchange/ and post a question there to have customer service refund the points for this question.

Don't for get to mention this question number: "Q.10253478"


Cheers!
USHASHI, You still there???
USHASHI, You still there???
ASKER CERTIFIED SOLUTION
Avatar of ianB
ianB

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial