CreateDirectory Function

Declare Function CreateDirectory Lib "kernel32.dll" Alias "CreateDirectoryA" (ByVal lpPathName As String, lpSecurityAttributes As SECURITY_ATTRIBUTES) As Long

Platforms

Description & Usage

CreateDirectory creates a new directory on a disk. It also allows you to specify the security attributes of the newly created directory, if the operating system supports it.

Return Value

If an error occured, the function returns 0 (use GetLastError to get the error code). If successful, the function returns a non-zero value.

Visual Basic-Specific Issues

None.

Parameters

lpPathName
The name of the new directory to create.
lpSecurityAttributes
Windows NT, 2000: The security attributes to assign to the newly created directory. Windows 95, 98, CE: This parameter is ignored.

Example

' Create the new directory C:\Dummy\NewDir and
' give it default security attributes.
Dim secattr As SECURITY_ATTRIBUTES  ' security attributes structure
Dim retval As Long  ' return value

' Set the desired security attributes
secattr.nLength = Len(secattr)  ' size of the structure
secattr.lpSecurityDescriptor = 0  ' default (normal) level of security
secattr.bInheritHandle = 1  ' this is the default setting

' Create the directory.
retval = CreateDiectory("C:\Dummy\NewDir", secattr)

Related Functions

CreateDirectoryEx, RemoveDirectory

Category

Files

Back to the index.


Last Modified: December 24, 1999
This page is copyright © 1999 Paul Kuliniewicz. Copyright Information

Go to Paul Kuliniewicz's Home Page.
E-mail: rogue953@hotmail.com
This page is at http://skyscraper.fortunecity.com/transmission/45/api/c/createdirectory.html