VB6 Tutorial **Creating A Program To Open Other Programs**

Post here about scripting and programming for HaloPC (audio, network, ai, etc.)
Post Reply
Cheech|N|Chong





Posts: 115
Joined: Fri Jan 14, 2005 9:26 am
Location: Why The Fuck Would I Tell You? Indiana...
Contact:

VB6 Tutorial **Creating A Program To Open Other Programs**

Post by Cheech|N|Chong »

Ok, this tutorial will teach you how to make a program open other programs. Ok Lets Start.
First open up VB, and create a new stand form.
name is Program, and change the caption to "Commonly Used Programs", in the properties box for the form. Now click the image icon and drag it over the form:
Image
In the properties box go down to "picture and select an image that you want. Adjust the size of the image box to fit the image. Keep doing the image icon until you have all the programs you want to have an image on it: Image
If you have a lot of programs start doing the others in checkboxes instead of images. I recommend only putting like game images, not diff programs like Photoshop: Image
Create Command Button, and change the caption to "launch!" (see the image above).
Double Click the Command Button and write the code you want.
This is my code:

Code: Select all

Private Sub Command1_Click()
Dim cs As String
Dim p2p As String
Dim lime As String
Dim max As String
Dim ds As String
Dim aware As String
Dim spy As String
Dim mech As String
Dim priv As String
cs = Check1.Value
p2p = Check2.Value
lime = Check3.Value
max = Check4.Value
ds = Check5.Value
aware = Check6.Value
spy = Check7.Value
mech = Check8.Value
priv = Check9.Value

If cs = True Then Shell "C:\Program Files\Adobe\Photoshop CS\Photoshop.exe"
If p2p = True Then Shell "C:\Program Files\Warez P2P Client\warez.exe"
If lime = True Then Shell "C:\Program Files\LimeWire\LimeWire.exe"
If max = True Then Shell "C:\Program Files\SWiSHmax\SwishMax.exe"
If ds = True Then Shell "C:\3dsmax7\3dsmax.exe"
If aware = True Then Shell "C:\Program Files\Lavasoft\Ad-Aware SE Professional\Ad-Aware.exe"
If spy = True Then Shell "C:\Program Files\Spybot - Search & Destroy\SpybotSD.exe"
If mech = True Then Shell "C:\Program Files\Registry Mechanic\RegMech.exe"
If priv = True Then Shell "C:\Program Files\Privacy Guardian\pg.exe"

Ok the dim parts states that we want to use the syntex written after 'dim' to specify one of the images we put it, or the textboxes. Example: 'dim cs as string' cs is photoshop cs so instead of typing photoshop cs when we code later we'll type cs instead for shorter. Of course the program doesn't know what 'cs' is so we write this after all the 'dims':

Code: Select all

 cs = Check1.Value

This tells the program that cs is check1.value which is the name of my checkbox that I caption 'Photoshop CS' Do the same for the rest. The next coding is telling the program what to do if one of the checkboxes is checked.
Example: (If cs = True Then Shell "C:\Program Files\Adobe\Photoshop CS\Photoshop.exe")
This tells the program that if cs (check1.value) is 'True' (in other words is checked), to open "C:\Program Files\Adobe\Photoshop CS\Photoshop.exe" which is where my Photoshop CS is located. The ''Then Shell "C:\Program Files\Adobe\Photoshop CS\Photoshop.exe" Tells the program if check1.value is true 'THEN' open Photoshop CS at the following directory (C:\Program Files\Adobe\Photoshop CS\Photoshop.exe). The shell command just tells it that you want the program to open a file from your computer, then you type the directory of the program.
Ok for the image files: Double click them and code it but make needed changes to fit your program directory:
This is my code:

Code: Select all

Private Sub Picture2_Click()
Shell "C:\Program Files\Microsoft Games\Halo\halo.exe"
End Sub

This tells the program to open 'C:\Program Files\Microsoft Games\Halo\halo.exe'.
This is the code to my other image:

Code: Select all

Private Sub Picture1_Click()
Shell "C:\Program Files\Red Storm Entertainment\RavenShield\system\RavenShield.exe"
End Sub

This again tells the program to open 'C:\Program Files\Red Storm Entertainment\RavenShield\system\RavenShield.exe'. Just click the image and you will launch the program. For the checkboxes you will need to check them first then click the command button to launch the file.
The code above: Example: 'shell HardDriveLetter\Folder\OtherFolder\Filename.exe'


If you have any problems email me at
king___2004@sbcglobal.net
Other than that hope you enjoyed this tutorial!
Signature exceeded 75KB.
~{DE}~Demolisher





Posts: 100
Joined: Thu Dec 02, 2004 8:35 am
Location: MS,USA
Contact:

Post by ~{DE}~Demolisher »

Good tut im getting good a vb with all these tutorials.
Signature exceeded 75KB.
Cheech|N|Chong





Posts: 115
Joined: Fri Jan 14, 2005 9:26 am
Location: Why The Fuck Would I Tell You? Indiana...
Contact:

Post by Cheech|N|Chong »

~{DE}~Demolisher wrote:Good tut im getting good a vb with all these tutorials.
thx...if u want some more tutorials by me visit these links (if u havnt already, they're in this forum)

1. Multiplication Program: http://www.halomods.com/forums/viewtopic.php?t=21376

2. Making you form open other forms: http://www.halomods.com/forums/viewtopic.php?t=20643
Signature exceeded 75KB.
~{DE}~Demolisher





Posts: 100
Joined: Thu Dec 02, 2004 8:35 am
Location: MS,USA
Contact:

Post by ~{DE}~Demolisher »

Lol ive read those and btw their really good thx i bet alot of people appreciate them including me.
Signature exceeded 75KB.
stratoskater





Posts: 76
Joined: Wed Dec 29, 2004 7:57 am
Location: Crying at xaviers grave while at the same time fighting off a herd of your ugly faces.
Contact:

Post by stratoskater »

meh, not trying to bring you down, but there is a way easier way to do this without any programming experience and/or coding experience. http://ib.forum77.com/index.php?mforum=hp&showtopic=75
Sig must be under 50KB. Read the rules before reposting.
Cheech|N|Chong





Posts: 115
Joined: Fri Jan 14, 2005 9:26 am
Location: Why The Fuck Would I Tell You? Indiana...
Contact:

Post by Cheech|N|Chong »

lol...nothing anyone says can bring me down, im not 11 anymore
but i dont think u can rename the caption so it will have to stay blahblahblah.exe
plus im showing how to open programs with images, not just label buttons, and showin how to use command buttons

and im tryin to get ppl into coding some, not just browsing into a directory and pressing open then saving their file :wink:
Signature exceeded 75KB.
Post Reply