Hi again Saju
This is a little sample Vb code that is using the "CreateDirectory":
'In general section
Private Declare Function CreateDirectory Lib "kernel32" Alias "CreateDirectoryA" (ByVal lpPathName As String, lpSecurityAttributes As SECURITY_ATTRIBUTES) As Long
Private Type SECURITY_ATTRIBUTES
nLength As Long
lpSecurityDescriptor As Long
bInheritHandle As Long
End Type
Private Sub Command1_Click()
'KPD-Team 1998
'URL:
'E-Mail: KPDTeam@Allapi.net
Dim Security As SECURITY_ATTRIBUTES
'Create a directory
Ret& = CreateDirectory("C:\Directory", Security)
'If CreateDirectory returns 0, the function has failed
If Ret& = 0 Then MsgBox "Error : Couldn't create directory !", vbCritical + vbOKOnly
End Sub
****
Steps to translate the sample in Powercobol:
- First, load the library "Kernel32.lib" from \Fujitsu Cobol\COBOL\ using the Insert file project option.
- On Working-Storage section declare:
01 SECURITY GLOBAL.
02 nLength PIC S9(9) COMP-5.
02 lpSecurityDescriptor PIC S9(9) COMP-5.
02 bInheritHandle PIC S9(9) COMP-5.
01 pathname PIC X(128).
01 RESULT PIC S9(9) COMP-5.
- On the script event or procedure:
MOVE "MyFolder" TO PATHNAME
CALL "CreateDirectoryA" WITH STDCALL LINKAGE
USING BY REFERENCE PATHNAME
BY VALUE SECURITY
RETURNING RESULT
EVALUATE RESULT
WHEN 0
INVOKE POW-SELF "DISPLAYMESSAGE"
USING "Errors on folder creation"
WHEN OTHER
INVOKE POW-SELF "DISPLAYMESSAGE"
USING "DONE"
END-EVALUATE
That's All.
Hope in this help.
Gianni