
How-To... - Find the locations of the Windows, System and Temporary Directories
Because
Microsoft gives you the option to install Windows in a different location
rather than C:\Windows, using these Functions to find the location of the
directories is a must. For example, if you want to write a file to the Windows
directory and you use, for example, open "c:\windows\dodgesoft.ini"
for ..................", and Windows has been installed to another location(e.g.
C:\Win98), then your program will crash and the user will not want to, and
may even not be able to use your program again.
There is three functions -- GetWindowsDirectory, GetSystemDirectory
and GetTempPath. Each one does as you would believe them to - return
their locations. The code has been documented to let you know what is going
on.
Using these functions will make your program more efficient, and will make sure no errors will occur.