Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Find location of program. Check registry?

Find location of program. Check registry?

Scheduled Pinned Locked Moved C / C++ / MFC
questionwindows-admin
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    ChemmieBro
    wrote on last edited by
    #1

    I am developing a component that will be adding to an existing program. I need to add a certain file and/or folder to the program files if that file and/or folder does not already exists. But this is also dependent on which directory the program is installed on. How can I: 1. Check the registry, or some other method, to find which drive the program is installed on. 2. Check to see if a certain folder, on that drive, exists. #2 should be pretty simple, but I am unfamiliar with programming with the registry. Thank you in advance!

    D 1 Reply Last reply
    0
    • C ChemmieBro

      I am developing a component that will be adding to an existing program. I need to add a certain file and/or folder to the program files if that file and/or folder does not already exists. But this is also dependent on which directory the program is installed on. How can I: 1. Check the registry, or some other method, to find which drive the program is installed on. 2. Check to see if a certain folder, on that drive, exists. #2 should be pretty simple, but I am unfamiliar with programming with the registry. Thank you in advance!

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      ChemmieBro wrote: 1. Check the registry, or some other method, to find which drive the program is installed on. Without knowing any more about the program or how many assumptions can be made, this would require a search of each potential disk in the system. You can always search the registry in lieu of the disk(s) but there is no guarantee that it will be any faster. If you knew that the program was installed somewhere under the C:\Program Files folder, or in one particular hive of the registry, it would help. ChemmieBro wrote: 2. Check to see if a certain folder, on that drive, exists. I've always used _access(..., 0) for this.


      "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

      C 1 Reply Last reply
      0
      • D David Crow

        ChemmieBro wrote: 1. Check the registry, or some other method, to find which drive the program is installed on. Without knowing any more about the program or how many assumptions can be made, this would require a search of each potential disk in the system. You can always search the registry in lieu of the disk(s) but there is no guarantee that it will be any faster. If you knew that the program was installed somewhere under the C:\Program Files folder, or in one particular hive of the registry, it would help. ChemmieBro wrote: 2. Check to see if a certain folder, on that drive, exists. I've always used _access(..., 0) for this.


        "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

        C Offline
        C Offline
        ChemmieBro
        wrote on last edited by
        #3

        Well, I know it will be under either C:\Program Files or D:\Program Files or any other drive. This check will be done during initialization of my singleton COM object. I was thinking a registry check would be faster than checking the disk.

        D 1 Reply Last reply
        0
        • C ChemmieBro

          Well, I know it will be under either C:\Program Files or D:\Program Files or any other drive. This check will be done during initialization of my singleton COM object. I was thinking a registry check would be faster than checking the disk.

          D Offline
          D Offline
          David Crow
          wrote on last edited by
          #4

          ChemmieBro wrote: Well, I know it will be under either C:\Program Files or D:\Program Files or any other drive. Try this for starters.


          "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups