DECLARE "Sub name Lib ""libname"" [Alias ""aliasname""] [([arglist])]"
Declare "Function name Lib ""libname"" [Alias ""aliasname""] [([arglist])] [As type]"
Description
Declare an API function for use. The name is the name of the function to use as a function or subroutine in an NS Basic program. When this internal name within the DLL is different, use the Alias clause giving the internal name of the function. This is useful when an internal name conflicts with a keyword. The libname is the name of the DLL library. It may be a full pathname to the DLL or a partial pathname or single file name, in which case the system searches for the DLL. Most normal DLLs will be stored in the \Windows directory, in which case the path name can be omitted, and the system will find it quickly. See the Tech Note on Declare for additional documentation.
Example
Rem Get storage info on device
Dim lpAvailable, lpTotalBytes, lpTotalFree
Declare "Function GetDiskFreeSpaceExW Lib ""Coredll"" (_
ByVal lpDirectoryName As String, _
ByRef lpFreeBytesAvailable As Long, _
ByRef lpTotalNumberOfBytes As Long, _
ByRef lpTotalNumberOfFreeBytes As Long) _
As Boolean"
res = GetDiskFreeSpaceExW("e:", _
lpAvailable, lpTotalBytes, lpTotalFree)
MsgBox "Available: " & lpAvailable
Output
Available: 123,000,004
Related Items