Finding Windows Directory
-
Hey all. Just wondering, what would be the best way to find out what the user's windows directory is? (e.g, sometimes its c:\winnt, other times c:\windows, or whatever other ideas the user decides to come up with). I want to be able to call (HH.EXE) which resides in the users system directory to launch my HtmlHelp files. I realize that I can simply call the .CHM file with shellexecute and that will launch it as long as the file type has been defined. But I want to be on the safe side in case that file type is not defined. I preferably do not want to have to get the windows directory by accessing the environment variable "windir", but if that is the best way about it, I guess it'll suffice! If so, can someone tell me how to go about accessing this environment variable ... or if there is a better way, enlighten me? Thanks Shultas
-
Hey all. Just wondering, what would be the best way to find out what the user's windows directory is? (e.g, sometimes its c:\winnt, other times c:\windows, or whatever other ideas the user decides to come up with). I want to be able to call (HH.EXE) which resides in the users system directory to launch my HtmlHelp files. I realize that I can simply call the .CHM file with shellexecute and that will launch it as long as the file type has been defined. But I want to be on the safe side in case that file type is not defined. I preferably do not want to have to get the windows directory by accessing the environment variable "windir", but if that is the best way about it, I guess it'll suffice! If so, can someone tell me how to go about accessing this environment variable ... or if there is a better way, enlighten me? Thanks Shultas
I think that unfortunately this is one area you have to read the environment - you didnt say what O/S here, I'm assuming NT.. try this :- #include <cstdlib> #include <iostream> using namespace std; int main() { char * sysdir = getenv("SystemRoot"); if (sysdir) cout<<"value of SystemRoot is: "<< sysdir<
-
Hey all. Just wondering, what would be the best way to find out what the user's windows directory is? (e.g, sometimes its c:\winnt, other times c:\windows, or whatever other ideas the user decides to come up with). I want to be able to call (HH.EXE) which resides in the users system directory to launch my HtmlHelp files. I realize that I can simply call the .CHM file with shellexecute and that will launch it as long as the file type has been defined. But I want to be on the safe side in case that file type is not defined. I preferably do not want to have to get the windows directory by accessing the environment variable "windir", but if that is the best way about it, I guess it'll suffice! If so, can someone tell me how to go about accessing this environment variable ... or if there is a better way, enlighten me? Thanks Shultas
I dont know how accurate this info is, but I'm going to contradict myself and offer this link I found after a quick look see a-la-google (and I just learnt something for today, that there does appear to be some API's for it other than looking in the environment) .. http://www.qinysoft.com/articles/vcdirectory.htm[^] hth, 'G'
-
Hey all. Just wondering, what would be the best way to find out what the user's windows directory is? (e.g, sometimes its c:\winnt, other times c:\windows, or whatever other ideas the user decides to come up with). I want to be able to call (HH.EXE) which resides in the users system directory to launch my HtmlHelp files. I realize that I can simply call the .CHM file with shellexecute and that will launch it as long as the file type has been defined. But I want to be on the safe side in case that file type is not defined. I preferably do not want to have to get the windows directory by accessing the environment variable "windir", but if that is the best way about it, I guess it'll suffice! If so, can someone tell me how to go about accessing this environment variable ... or if there is a better way, enlighten me? Thanks Shultas