` Printed Icetips Article

Icetips Article



Par2: Check directory/create directory
2002-04-05 -- Ville Vahtera
 
I thought to share this info I found during to try solve problem for
existing/not existing directory.
I needed a chance to create directory if the dir I were looking for
didn't exist.
Well, I found pretty neet API to call from imagehlp.dll. This api will
create automaticly that directory you're looking for if it dosen't
exist.

Global map:
Module('IMAGEHLP.DLL')
    MakeSureDirectoryPathExists(*CString DirPath),Long,Pascal,Raw
End

FullDirectoryName CString(255)

Usage:
FullDirectoryName = 'c:\Some_dir_I_need_to_create\'
x# = MakeSureDirectoryPathExists(FullDirectoryName)

When you call this API, it will check if the directory is there and if
there isn't any, it will create it for you :-)
...and remember to make and include imagehlp.lib for your project!


"Imagehlp.dll. On NT, requires version 4.0 or later. On Win9x, requires Windows 95 or
later"
with win2000:
"Starting with Windows 2000, you can no longer redistribute the ImageHlp DLL that is
included with the operating system. A subset of
the functions have been moved to a DLL that is redistributable. Existing applications will
continue to work because ImageHlp uses
forwarders to call into the new DLL"



Printed May 5, 2024, 7:25 am
This article has been viewed/printed 35170 times.