Kbase 17324: How to Call WIN32 API Function: CreateDirectory
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  10/05/1998 |
|
How to Call WIN32 API Function: CreateDirectory
DISCLAIMER:
===========
The code example in this knowledgebase is for informational purposes
only. If you have specific questions about which API calls would be
best suited to your design goals, please consult your Microsoft
documentation.
INTRODUCTION:
=============
The following sample code shows how to call the Win32 API function
called CreateDirectory. This function creates a new directory. If
the underlying file system is NTFS or another file system that
supports security on files and directories, the function applies a
specified security descriptor to the new directory. Windows 95 does
not use the file and directory security since it cannot access a
drive formatted with the NTFS file system. The sample code shown
below does not pass any security descriptor information to the API
call, that is why the second parameter is a LONG instead of a MEMPTR.
This code has been tested on Windows NT 4.0 Workstation only.
DEFINE VARIABLE intResult AS INTEGER NO-UNDO.
PROCEDURE CreateDirectoryA EXTERNAL "KERNEL32.DLL":
DEFINE INPUT PARAMETER chrNewDir AS CHARACTER.
DEFINE INPUT PARAMETER intSecurityAttrs AS LONG.
DEFINE RETURN PARAMETER intResult AS LONG.
END PROCEDURE.
RUN CreateDirectoryA ("C:\BRIAN", 0, OUTPUT intResult).
IF intResult = 1 THEN
MESSAGE "CreateDirectory Worked" VIEW-AS ALERT-BOX.
ELSE
MESSAGE "CreateDirectory Failed" VIEW-AS ALERT-BOX.
Progress Software Technical Support Note # 17324