Highlighted
Absent Member.
Absent Member.
565 views

[archive] CreateDirectory via API

[Migrated content. Thread originally posted on 17 January 2006]

Hello Everyone,
has anyone an example of using WinAPI to check existence and create/rename folder?
thanks in Advance, Giovanni
0 Likes
2 Replies
Highlighted
Absent Member.
Absent Member.

RE: [archive] CreateDirectory via API


77 mydir pic x(1024).
77 secflags pic x(4) comp-n.
...
PROCEDURE DIVISION
           CALL    "KERNEL32.DLL@WINAPI".
           STRING "C:\SomeDir" LOW-VALUES DELIMITED BY SIZE
                       INTO mydir.
           MOVE   0 TO secflags.
           CALL    "CreateDirectoryA" USING
                       BY REFERENCE mydir
                       BY VALUE secflags.
           CANCEL "KERNEL32.DLL".
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] CreateDirectory via API

Hi Gisle,
thankU for suggestion, I'd already solved in an look-alike manner:
*
01 security-attributes.
02 dwNLenght pic x(4) comp-x.
02 lpSecurityDescriptor pic x(8) comp-x.
02 bInheritHandle pic x(1) comp-x.
77 actual-folder-name pic x(256).
77 return-value signed-int.
*
...
call "kernel32.dll@__stdcall"
initialize security-attributes
call "@[DISPLAY]:CreateDirectoryA"
using by reference actual-file-name,
by reference security-attributes
giving return-value
if return-value is equal to -1 then
perform error_proc
cancel "kernel32.dll@__stdcall"
exit paragraph
end-if

however thankU so much! Giovanni
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.