Here are three potentially useful examples: "getsysd.ave" retrieves the Windows System directory, "mkdir.ave" makes a unique temporary directory under the $TEMP directory, and "rmdir.ave" removes an existing (empty) directory.
getsysd.ave: dllName = FileName.FindInSystemSearchPath("kernel32.dll") u32DLL = DLL.Make(dllName) GetSysDir = DLLProc.Make(u32DLL,"GetSystemDirectoryA",#DLLPROC_TYPE_INT32, {#DLLPROC_TYPE_STR,#DLLPROC_TYPE_INT32}) strSysDir = String.MakeBuffer(260) result = GetSysDir.Call({strSysDir,260}) if (result = 0) then strSysDir = "ERROR" end return strSysDir mkdir.ave: thePrefix = Self.Get(0) dllName = FileName.FindInSystemSearchPath("kernel32.dll") u32DLL = DLL.Make(dllName) MkDir = DLLProc.Make(u32DLL,"CreateDirectoryA",#DLLPROC_TYPE_INT32, {#DLLPROC_TYPE_STR,#DLLPROC_TYPE_VOID}) strNewDir = FileName.GetTmpDir.MakeTmp(thePrefix,"").GetFullName strSecAtt = "" result = MkDir.Call({strNewDir,strSecAtt}) if (result = 0) then strNewDir = "ERROR" end return strNewDir rmdir.ave: strRmDir = SELF.Get(0) success = true dllName = FileName.FindInSystemSearchPath("kernel32.dll") u32DLL = DLL.Make(dllName) MkDir = DLLProc.Make(u32DLL,"RemoveDirectoryA",#DLLPROC_TYPE_INT32, {#DLLPROC_TYPE_STR}) result = MkDir.Call({strRmDir}) if (result = 0) then success = false end return successRemember that Avenue cannot handle all types of data structures. For example, the second argument of "CreateDirectoryA" is a SECURITY_ATTRIBUTES structure. Fortunately, for this particular function the second argument is optional and NULL may be passed instead.
For an in-depth discussion of the Win32 API (a.k.a. "Platform SDK"), you can purchase the MSDN Library CD-ROM (free with Visual Basic or C++ pro editions), or one of several books available on the market. A list of the Win32 API declarations for Visual Basic may be downloaded at:
http://www.microsoft.com/officedev/o-free.htm
Finally, the following example doesn't use DLL calls. It's just a reminder that you can use ReadFiles to find and remove files in a directory.
rmfiles.ave: strRmDir = SELF.Get(0) success = true for each fnm in strRmDir.AsFileName.ReadFiles("*.*") if (File.CanDelete(fnm)) then File.Delete(fnm) else success = false end end return success