Find location of program. Check registry?
-
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!
-
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!
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
-
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
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.
-
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.
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