|
-
Nov 19th, 2002, 01:10 PM
#1
Thread Starter
Member
Confused by VBWorld-tip...
Sample found on VBWorld - looks very nifty, but: Reference docs state the DLL having the functions used below is named "DbgHelp.dll", not "ImageHlp.dll". Any expert out there who may throw some light on all this?
The tip (by K. Moore) -
Creating Nested Directories
This one works by calling a function in the IMAGEHLP DLL... and if the directory specified doesn't exist, it creates it for you. And you can go down as many levels as you want - this function handles nested directories with ease.
To use this code, call CreatePath, passing in the path to create. The function returns True if successful.
Usage
x = CreatePath("c:\program files\new app\database\references")
Code
VB Code:
Declare Function MakeSureDirectoryPathExists Lib _
"IMAGEHLP.DLL" (ByVal DirPath As String) As Long
Public Function CreatePath(NewPath) As Boolean
'Add a trailing slash if none
If Right(NewPath, 1) <> "\" Then
NewPath = NewPath & "\"
End If
'Call API
If MakeSureDirectoryPathExists(NewPath) <> 0 Then
'No errors, return True
CreatePath = True
End If
End Function
- end tip quote.
regards everybody /lumen
Last edited by lumen; Nov 19th, 2002 at 01:13 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|