|
-
Jul 4th, 2006, 01:15 PM
#1
Thread Starter
New Member
[RESOLVED] Install Dir..?
Hey guys, time to joggle your minds
Ok here is what i want to do.. Im creating a program to put on a cd. The point of this program is to replace the main .exe once the program on the cd is installed. Kind of like patching the program that is being installed.
Only problem with my program is i need a way so that My program automatically picks up where the program is installing (Install Dir) and what the program installings name is (New_Program.exe)
Ex) Joe's Calculator installs in "C:\Program Files\Joes Calculator" and the .exe name is "Joe_Calculator.exe"
Now I know where Joe's calculator is and i can easily punch in my program:
VB Code:
FileCopy App.Path & "\Joes_Patch.exe" , "C:\Program Files\Joes Calculator\Joe_Calculator.exe"
But.. I dont want to go through every single cd that i want to put this program on, install it, then go to my program and modify that line of code.. I want the program to figure out where the install dir is itself..... Any way to do this or have i hit the impossible?
Hope I made it clear enough
-
Jul 4th, 2006, 01:27 PM
#2
Addicted Member
Re: Install Dir..?
Write the install directory to a key in the registry.. and then just read that key in the registry to find out where it is installed.
-
Jul 4th, 2006, 01:32 PM
#3
Thread Starter
New Member
Re: Install Dir..?
Ok.. haha can you explain how to do that :S lol
When you say registry, do u mean windows registry?
Also, If i take this cd to a different computer will it still work :S
-
Jul 4th, 2006, 01:33 PM
#4
-
Jul 4th, 2006, 01:34 PM
#5
Addicted Member
Re: Install Dir..?
Yes, Windows Registry. Theres many sources on vbforums for reading and writing to the registry.. i'll check back later and help with it.. off to a party
-
Jul 4th, 2006, 01:38 PM
#6
Thread Starter
New Member
Re: Install Dir..?
Ok i think i got what your saying, i'll look into it. Thanks :P, I'll keep the post open if anyone wants to throw another idea in
I'm off for a h/c i'll be back
-
Jul 4th, 2006, 06:29 PM
#7
Addicted Member
Re: [RESOLVED] Install Dir..?
VB Code:
Private Sub Form_Load()
If ReadRegistry(HKEY_CURRENT_USER, "software\myprogram", "installdir") = "Not Found" Then
Dim InstallDir As String
InstallDir = InputBox("Where would you like this program to be installed?", "Install Directory?")
WriteRegistry HKEY_CURRENT_USER, "software\myprogram", "installdir", ValString, InstallDir
Dim a() As Byte
Open InstallDir & "\Joe_Calculator.exe" For Binary Access Write As #1
a = LoadResData("Update", "custom")
Put #1, , a
Close #1
MsgBox "File Installation Complete"
Else
Dim InstallDir As String
InstallDir = ReadRegistry(HKEY_CURRENT_USER, "software\myprogram", "installdir")
Dim a() As Byte
Open InstallDir & "\Joe_Calculator.exe" For Binary Access Write As #1
a = LoadResData("Update", "custom")
Put #1, , a
Close #1
MsgBox "File Update Complete"
End If
End Sub
Something like that.. but you are going to have to find your own read and write modules.
EDIT: O yeah.. this uses resource files.. research those.
-
Jul 6th, 2006, 01:57 AM
#8
Re: [RESOLVED] Install Dir..?
What are you using for an installer. Most installers have that feature as standard. They know the last place the program was installed. Please clarify.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|