[fpc-pascal]divining windows system paths

Gabor DEAK JAHN djg at tramontana.co.hu
Thu Nov 1 15:37:51 CET 2001

At 11/1/01 10:15 AM, you wrote:


 > You may be able to get away with dropping the IMalloc calls. I really don't
 > know. You may end up crashing/screwing up Explorer though, as Explorer ('the
 > shell') has to explicitly release all memory it allocates.

There are two ways, SHGetSpecialFolderLocation and SHGetSpecialFolderPath.
With the second, you have to use IMalloc because the system allocates the
memory and expects you to free it. Therefore, Using SHGetSpecialFolderPath
seems to be much simpler (it is a single call, not the complex structures
you quoted, returning the path directly instead of a PIDL which you have to
convert to a path and deallocate yourself) but the problem is that it is
only available starting from version of 4.71 of Shell32.dll (this means
2000, ME or Internet Explorer 4.0 or later installed on previous systems).

However, there is a redistributable ShFolder.dll which you are free to
include with your program and then you'll be able to use this simpler
function on any system and version.


Gabor DEAK JAHN -- Budapest, Hungary.
E-mail: djg at tramontana.co.hu

More information about the fpc-pascal mailing list