-
Installer stub heaven
I'm trying to write an installer stub for my VB programs since QB 4.5 compiles to a real EXE albeit a 16-bit one. Here's what I need to do (I think) after the user extracts the contents of a ZIP file as if they downloaded a setup from my site.
1. Get the windows\system dir
2. See if the VB runtimes exist there; if not copy them from the current directory
3. Shell out my full-blown VB installer now that VBs dependencies are copied
4. Exit automatically
But here's the problem:
1. What's a way to determine if a file exists in QBasic, considering that error trapping doesn't work in functions or subs?
2. What's a way to get the Windows directory?
-
YES! I HAVE FINALLY ASKED THE UNANSWERABLE QUESTION!
:rolleyes: :(
-
You may need to combine some batch file programming with QBasic to perform this function. I don't know what versions of Windows you are trying to install your VB app on, but you may be able to use the PATH environment variable to determine where Windows is installed. Unless the user installed Windows to some non-standard folder (for example I:\OpSys5), you should be able to determine the correct path 99.9% of the time. Even if they have installed more than one operating system or version of Windows, the PATH variable should point to the currently running version (unless they have purposely included more than one valid Windows directory in their PATH). Look for 'Windows' or 'Winnt' and you should be OK.
Batch file command to create a text file containing the PATH:
ECHO %PATH% > PATHLIST.TXT
You can now read in the PATHLIST.TXT file and examine it for a likely looking Windows directory. When you have found it, replace C:\WINDOWS in the batch file below to copy the files.
Note: You can re-do the batch file to use parameters to specify the source file names and target directory if you want, then just call it as many times as you need to.
IF EXIST C:\WINDOWS\FILENAME.DLL GOTO LABEL1
COPY FILENAME.DLL C:\WINDOWS\FILENAME.DLL
:LABEL1
IF EXIST C:\WINDOWS\FILE2.XXX GOTO END
COPY FILE2.XXX C:\WINDOWS\FILE2.XXX
:END
REM PUT YOUR COMMAND TO RUN YOUR VB INSTALLER HERE
You can e-mail me at [email protected] if you have any questions about this technique.
-
Cool idea; I'll try it out later. :cool:
Others, keep the suggestions coming anyway, it's always good to have a second opinion...
-
i would suggest trying somit other than QB ... like C, C++ or Delphi
-
this type of program would actually be pretty easy in c++ now that i am thinking about it.
-
I don't even know how to do the equivalent of Shell in C++. :( :mad: But I know the language basics.
-
perhaps it would be a good learning experience.
Perhaps i could help you!
maybe we should start a project in communication forum.
-
Sounds cool; I'll start one.
-
Done: http://www.vbforums.com/showthread.p...hreadid=110481
Thread locked, please participate in the new thread above instead.