LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I create more then one Directory at once

Solved!
Go to solution

I have this Path "c:\test\" and i want to create this "c:\test\aaa\bbbb"

The Problem that I have is, that I have to create every time a different number of Directorys.

One Time I have to creat one Dir another time i have to create three Dir's and so on.

 

With makedir I only can creat on dir at once

 

Thanks for helping

0 Kudos
Message 1 of 4
(3,831 Views)
Solution
Accepted by topic author Kai W

The Windows SDK defines this handy function:

int SHCreateDirectory( HWND hwnd, LPCWSTR pszPath );

 

you need to #include "shlobj.h" and eventually add "shell32.lib" to the project. use NULL for the window handle if you don't have one. this will create any intermediate path. search in the SDK documentation or on the net for more details on the return values.

Message 2 of 4
(3,815 Views)

I don't mean to tread on this solution but I did some investigation on this function and found a couple of things out.  This function has been dropped in Windows Vista.  However, there is another similar one that goes like this:

 

int SHCreateDirectoryEx(      
    HWND hwnd,
    LPCTSTR pszPath,
    const SECURITY_ATTRIBUTES *psa
);

 

where SECURITY_ATTRIBUTES can be NULL if you don't need it.  It has been carried over to Vista but who is to say they won't yank this one too down the road.  My question is as follows; Is there an equivalent function to this Win32 call that is native to LabWindows (i.e. inside a library that is unique to LabWindows)?  It would make sense to provide such a function to sort of future proof LabWindows itself.  My own needs for this function are so that I can get the error back that says the directory already exists.  I don't believe MakeDir() or MakePathname() do that.  Thanks.

0 Kudos
Message 3 of 4
(3,431 Views)

The Shell SDK function PathIsDirectory() might be more convenient for your needs.

 

JR

0 Kudos
Message 4 of 4
(3,414 Views)