Re: Asking Advice

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance




It happens that Nobody formulated :
"Karl E. Peterson" <karl@xxxxxxxxxx> wrote in message news:%23mMcIT6dKHA.3792@xxxxxxxxxxxxxxxxxxxxxxx
I think it'll work on 98 natively, though, and 95 if IE5+ is installed. It requires Shell v5.00+.

No. IE5 doesn't update Shell32.dll. See "5.0 Shell32.dll" row here and Note 3:

Shell and Common Controls Versions
http://msdn.microsoft.com/en-us/library/bb776779(VS.85).aspx

The notes talk about several DLL's, which makes it confusing to read. In this case, only look for what it says about Shell32.dll, which is where that function is implemented.

Hmmmm, you're right. I was thinking shlwapi. <grumble>

Anyway, one could easily make a For loop scanning backward and look for "\" and use GetAttr() and MkDir to make a pure VB solution.

Okay, gonna toss this one out to see who can shoot it down quickest...

Public Function MkDirs(ByVal Folder As String) As Boolean
Dim f() As String
Dim attr As Long
Dim i As Long

' Split incoming folder into subfolders.
f = Split(Folder, "\")
For i = 1 To UBound(f)
f(i) = f(i - 1) & "\" & f(i)
Next i

On Error Resume Next
For i = 0 To UBound(f)
' Check if this level already exists.
attr = GetAttr(f(i))
If Err.Number Then
' Folder likely doesn't exist,
' clear error and create.
Err.Clear
MkDir f(i)
If Err.Number Then Exit For
End If
Next i

' Return success?
MkDirs = CBool(GetAttr(Folder) And vbDirectory)
End Function

I've sure seen a lot of these over the years, but I guess never saw one I liked enough to bother hanging onto. Anyone see a scenario this one wouldn't handle?

--
[.NET: It's About Trust!]


.



Relevant Pages