Hi All,

I have to create a directory by using Windows API, can anybody give me small code snippet for this. I am able to do it File System Objet but want to do it by using Win API.
Can any body atleast tell me in which class or dll this will be available or a small code snippet if possible.

Thanks,
Aleem Mohammad.

Why don't you use

MkDir "C:\TempDir"

Ok. If you want to do it hard way:

Private Declare Function CreateDirectory Lib "shell32.dll" Alias "SHCreateDirectoryExA" (ByVal hwnd As Long, ByVal pszPath As String, ByVal psa As Any) As Long

CreateDirectory Me.hWnd, "C:\TempDir", Nothing

just make sure to check return value for errors.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.