| Home | Previous Lesson: Setting the Current Directory Next Lesson: Finding the Computer Name |
Declare a local external function as shown below.
FUNCTION boolean ufx_CreateDirectory(ref string &
pathname, int sa) LIBRARY "Kernel32.dll" &
ALIAS FOR "CreateDirectoryA"
The following code creates the specified directory. For example, if you specify "c:\WINNT\test" as argument, it is not going to destroy whole WINNT directory and create a fresh one for you. It doesn't touch the existing ones and creates the missing ones, in this case, it is 'test'.
// Object: cb_create_dir
// Event: Clicked
string ls_dir
ls_dir = trim(sle_directoryName.Text)
If ufx_CreateDirectory(ls_dir, 0) then
MessageBox("CreateDirectory", &
sle_directoryName.Text + " is successfully created" )
else
MessageBox("CreateDirectory", "Failed")
end if
| Home | Previous Lesson: Setting the Current Directory Next Lesson: Finding the Computer Name |