[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 :sick: :D
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.
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.