Self-extracting utility programs

This forum is for eXpress++ general support.
Post Reply
Message
Author
User avatar
rdonnay
Site Admin
Posts: 4813
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Self-extracting utility programs

#1 Post by rdonnay »

I often like to write utility programs in Xbase++, even if they are small (such as PATHUTIL.EXE) or large (such as XDOT.EXE).

The problem is that to insure they will run requires that there is always a good path to the Xbase++ and eXpress++ runtime DLLs and, sometimes, CH files.

PATHUTIL.EXE is a very handy utility, written in eXpress++ and Xbase++ by Bobby Drakos.
It helps to debug problems in programs in which the programmer must find what files are being used by the program, based on the current environment. Unfortunately, if the system's environment is not set up correctly, even PATHUTIL.EXE may not run.

I solved this problem the following way:

1. I determined which eXpress++ and Xbase++ .DLLs are needed by running Alaska's DLLINFO.EXE utility. This displays a list of only the DLLs that are called by the program. DLLs which are called from the C:\Windows folder and subfolders are ignored.

2. I created a .ZIP file that contains the Executable program and only the DLLs that are needed by the program.

3. I used the Chilkat ZIP 2 Secure (free) utility to create a self-extracting executable from the .ZIP file. It can be downloaded here: https://www.chilkatsoft.com/chilkatsfx.asp

See the below screen shot to see how to configure the self-extracting EXE. This configuration will cause the created DCPATH.EXE to unzip itself into a newly created folder named C:\temp\pathutil, run the PATHUTIL.EXE program, and then delete all the files and the folder when the program is closed. The program will always run, regardless of the environment and will always clean up after itself afterwards and leave no trace of the files.
chilkat.jpg
chilkat.jpg (55.55 KiB) Viewed 6995 times
Here is DCPATH.EXE. Give it a try: http://bb.donnay-software.com/util/dcpath.exe

Here is DCDOT.EXE. http://bb.donnay-software.com/util/dcdot.exe
The eXpress train is coming - and it has more cars.

User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

Re: Self-extracting utility programs

#2 Post by Eugene Lutsenko »

Those are very useful things. Thank you

User avatar
unixkd
Posts: 579
Joined: Thu Feb 11, 2010 1:39 pm

Re: Self-extracting utility programs

#3 Post by unixkd »

Hi Roger

This utility looks interesting and I guess it is based on Chilkat Zip ActiveX.

It supports:

1. Create or open in-memory Zips.

2. Can embed Zips in your own EXEs.

I am thinking with this possibilities, One can pack all Xbase++/Express++/Activex dll/Ocx runtime DLLs into Zip and embed it to one's EXE then register the activex then we are closer to achieving something similar to products like BoxedApp Packer or other application packer in the market.

What will happen if the application does NOT close normally ?

Just an Idea !!!

Thanks.

Joe

User avatar
rdonnay
Site Admin
Posts: 4813
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Self-extracting utility programs

#4 Post by rdonnay »

What will happen if the application does NOT close normally ?
It depends on what you mean by "normally".
I tried to close the program with Alt-C and also with Task Manager.
In both cases the files were deleted.
If any new files are created in the temp folder, they will not be deleted and the folder with not be deleted.
Only the files that were extracted from the self-extracting zip will be deleted.
This utility looks interesting and I guess it is based on Chilkat Zip ActiveX.
I don't think it has anything to do with ActiveX.
It's just a program that creates self-extracting exectuables.
It doesn't install any ActiveX controls.
One can pack all Xbase++/Express++/Activex dll/Ocx runtime DLLs into Zip and embed it to one's EXE then register the activex
This is not an install program. It won't register an ActiveX control.
You can do this, however, in your program. You will need to look in the registry to see if the control is registered first.

Example:

Code: Select all

   cRegSvr := "RegSvr32.exe"
   cRegQuery := DC_RegQuery(HKEY_CLASSES_ROOT,'\CLSID\{644D8000-3033-A583-AD61-00403333EC93}','')
   IF Valtype(cRegQuery) # 'C' .OR. Empty(cRegQuery)
     RunShell('MDraw30.ocx /s',cRegSvr)
     DCMSGBOX 'Registering MetaDraw 3.0 OCX' TIMEOUT 1
   ENDIF
The eXpress train is coming - and it has more cars.

Post Reply