Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

setup program

Status
Not open for further replies.

beyondsociety

Technical User
May 9, 2002
40
US
Hi,

I made a program and I sent it to my friend and he had trouble unzipping it and so he asked me to put it on a cd. I need to know if anybody knows how to make a setup program in qbasic that will install the program in windows and be able to run from the start menu.
 
Why can't you just give him the program on CD already expanded?

I just can't see how a QB program and necessary files could possibly use 600+ MB of room on a CD.

This would be easier and simpler...than to write your own install prg and take into account all flavors of Windows not to mention custom OEM OS setups. --MiggyD

Never be afraid to try something new. Remember that amateurs built the Ark. Professionals built the Titanic.
 
If you want to write a setup prg, then just make a folder on the disc, and use the shell command to run a DOS copy command, to copy all the files to the hard disk.
Try this one.


Make a folder called FILES.
Put all the files you want to install into it.
put the installer into the parent folder- ie

The installer could be
a:\install.exe

and the files could be in
a:\files
NOTE: The error trap only catches QBasic errors, not DOS ones!

Just paste this code into notepad, and save as a BAS file. Then, open it with Qb :)

Enjoy.



SCREEN 12
CLS
ON ERROR GOTO FAIL

PRINT "Installer - Guest;
PRINT : PRINT
INPUT "Install to which folder ", destination$
PRINT : PRINT

PRINT &quot;Press <ESC> to abort, or <ENTER> to install&quot;

TL:
SELECT CASE INKEY$
CASE CHR$(27)
END

CASE CHR$(13)
GOTO DOIT

CASE ELSE
GOTO TL:

END SELECT

DOIT:
PRINT &quot;Okay, I'm gonna make the directory &quot; + destination$
SHELL &quot;MKDIR &quot; + destination$

PRINT &quot;Copying...&quot;
SHELL &quot;CD FILES&quot;
SHELL &quot;COPY *.* &quot; + destination$
PRINT &quot;Done.&quot;
END

FAIL:
PRINT &quot;ERROR!!!!!!!!&quot;
PRINT &quot;Error &quot; + ERR + &quot; occured on line &quot; + ERL + &quot;.&quot;
PRINT &quot;The program will now end.&quot;


 
To make an application show up inside the start menu, one only has to add a directory with a few link files inside the &quot;Windows\Start Menu\Programs\&quot; directory.

Most people install Windows to the default &quot;C:\Windows\&quot; dir, but to be on the safe side you should retreve the windows directory from the system, and work with it.

If you want your installation program to have a splash screen, or start the installation automaticly on disk insertion, create a file called &quot;Autorun.inf&quot; on the CD that contains the path (relitive to the CD ROM root directory) of the installation program or splash screen like this:

[autorun]
OPEN=(Path and Filename).exe
 
If you are using earlier versions of windows nyajsk1's idea will work great, but in XP the folder is
c:\documents and settings\*person's name*\start menu
i am pretty sure that if you try to SHELL that it will give you an error because of the length of the name and the spaces in it
 
Atculy QBasicKing, this example will work under *any* version of windows. This is because, even though you can have personalized menus in Windows2000 and WindowsXP, the directory
Code:
&quot;C:\WINDOWS\START MENU\&quot;
is still present. It just affects all of the users and not just one particular one.
 
my mistake, it is there, but under c:\documents and settings\all users\start menu
 
Did you look under
Code:
&quot;C:\WINDOWS\START MENU\&quot;
?
 
Well, even if it is, that's not a big deal... Just:

SHELL &quot;VER > Version.inf&quot;

And determine what version of windows you are running on.
 
But I do know that
Code:
&quot;C:\WINDOWS\START MENU\&quot;
is present in Windows2000.
 
2000 maybe, but not XP

if you ask the SHELL for the version type I think that XP is windows 5.1
 
But whats more important then the version number, is what kind of windows you are running on. If you are running on Windows2000 or WindowsXP, use

C:\Docume~1\Alluse~1\Startm~1\Programs
If you are running on Windows95 or Windows98 use:

C:\Windows\Startm~1\Programs
That should do it.

Shell &quot;Ver > WinVer.inf&quot;
Filenum = Freefile
Open &quot;WinVer.inf&quot; for input as #Filenum
Input #Filenum, Temp$
Close #Filenum
If UCase$(Left$(Temp$, 20)) = &quot;MICROSOFT WINDOWS 98&quot; Then
' Do stuff for Windows98
Elseif UCase$(Left$(Temp$, 22)) = &quot;MICROSOFT WINDOWS 2000&quot; Then
' Do stuff for Windows2000
' Elseif for whatever WindowsXP returns...
' Do stuff for WindowsXP
Endif

...could someone tell me what WindowsXP returns?
 
I still say my original suggestion would expel any problems that have been mentioned above.

1) You can create directories and hard code them if needed from the CD-Rom drive (ex: Open &quot;.\mysubdir\thisfile.txt&quot; for input as x).

2) EXE and associated files will be localized [on the CD-Rom].

3) You can verify that the program has not been copied to the hard drive (a quick WRITE #x, &quot;this drive is write-able&quot; should do). This alone will help with some security issues you may have.

-- And --

4) You mentioned a friend; it is not a necessity to have a setup program, unless you plan on packaging it for sale/mass distribution.

Don't let me stop you though, if you believe you REALLY need a setup program then follow up on the suggestions previously mentioned atop.

Good Luck in any case,
MiggyD
 
By the way... I figured out where &quot;C:\WINDOWS\START MENU&quot; came from... It's a leftover directory from before I upgraded to Windows2000.
 
To answer Nyaj2k1's question about what Windows XP returns for a version, I think that if you could type VER at the command prompt it should return something like:

Microsoft Windows XP [version x.x.z]

Where x is tha actual version number, and z is the build number.

I don't know if this is what your looking for exactly?

NerfHerder

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top