Kbase 17327: How to Call WIN32 API Function: CreateDirectoryEx
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  10/05/1998 |
|
How to Call WIN32 API Function: CreateDirectoryEx
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 CreateDirectoryEx. This function is the same as the
CreateDirectory() function, except that the new directory retains the
attributes of a given template directory. If the underlying file
system supports security on files and directories, the function
applies the given security descriptor to the new directory. The new
directory retains the other attributes of the template directory. The
sample code shown below does not pass any security descriptor
information to the API call, that is why the third 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 CreateDirectoryExA EXTERNAL "KERNEL32.DLL":
DEFINE INPUT PARAMETER chrTemplateDir AS CHARACTER.
DEFINE INPUT PARAMETER chrNewDir AS CHARACTER.
DEFINE INPUT PARAMETER intSecurityAttrs AS LONG.
DEFINE RETURN PARAMETER intResult AS LONG.
END PROCEDURE.
RUN CreateDirectoryExA ("C:\WINNT", "C:\BRIAN", 0, OUTPUT intResult).
IF intResult = 1 THEN
MESSAGE "CreateDirectoryEx Worked" VIEW-AS ALERT-BOX.
ELSE
MESSAGE "CreateDirectoryEx Failed" VIEW-AS ALERT-BOX.
Progress Software Technical Support Note # 17327