Results 1 to 8 of 8

Thread: [RESOLVED] Install Dir..?

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2006
    Posts
    9

    Resolved [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:
    1. 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

  2. #2
    Addicted Member
    Join Date
    Jan 2006
    Posts
    246

    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.

  3. #3

    Thread Starter
    New Member
    Join Date
    Jun 2006
    Posts
    9

    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

  4. #4

  5. #5
    Addicted Member
    Join Date
    Jan 2006
    Posts
    246

    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

  6. #6

    Thread Starter
    New Member
    Join Date
    Jun 2006
    Posts
    9

    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

  7. #7
    Addicted Member
    Join Date
    Jan 2006
    Posts
    246

    Re: [RESOLVED] Install Dir..?

    VB Code:
    1. Private Sub Form_Load()
    2. If ReadRegistry(HKEY_CURRENT_USER, "software\myprogram", "installdir") = "Not Found" Then
    3.     Dim InstallDir As String
    4.     InstallDir = InputBox("Where would you like this program to be installed?", "Install Directory?")
    5.     WriteRegistry HKEY_CURRENT_USER, "software\myprogram", "installdir", ValString, InstallDir
    6.     Dim a() As Byte
    7.     Open InstallDir & "\Joe_Calculator.exe" For Binary Access Write As #1
    8.     a = LoadResData("Update", "custom")
    9.     Put #1, , a
    10.     Close #1
    11.     MsgBox "File Installation Complete"
    12. Else
    13.     Dim InstallDir As String
    14.     InstallDir = ReadRegistry(HKEY_CURRENT_USER, "software\myprogram", "installdir")
    15.     Dim a() As Byte
    16.     Open InstallDir & "\Joe_Calculator.exe" For Binary Access Write As #1
    17.     a = LoadResData("Update", "custom")
    18.     Put #1, , a
    19.     Close #1
    20.     MsgBox "File Update Complete"
    21. End If
    22. 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.

  8. #8
    Banned randem's Avatar
    Join Date
    Oct 2002
    Location
    Maui, Hawaii
    Posts
    11,385

    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
  •  



Click Here to Expand Forum to Full Width