xHarbour Reference Documentation > Function Reference |
Executes a function located in a dynamically loaded external library.
CallDll( <pFunction> [,<xParams,...>] ) --> xResult
The function returns the result of the called DLL function as a numeric value.
CallDll() exeutes a function located in a DLL that is not created by the xHarbour compiler. It works almost like function DllCall(), but accepts a function pointer obtained by GetProcAddress(), rather than the name of the DLL file and function. The calling convention is DC_CALL_STD. Refer to function DllCall() for more information on calling external DLL functions.
See also: | DllCall(), DllExecuteCall(), DllPrepareCall(), FreeLibrary(), GetProcAddress(), GetLastError(), LoadLibrary() |
Category: | DLL functions , xHarbour extensions |
Source: | rtl\dllcall.c |
LIB: | xhb.lib |
DLL: | xhbdll.dll |
// The example implements a simple command line utility // that opens a file using the associated file viewer. PROCEDURE Main( cFile ) LOCAL nDll, pFunc IF cFile == NIL .OR. .NOT. File( cFile ) CLS ? "File name must be specified" QUIT ENDIF nDll := DllLoad( "Shell32.dll" ) pFunc := GetProcAddress( nDll, "ShellExecute" ) ? CallDll( pFunc, 0, "open", cFile, NIL, NIL, 1 ) DllUnload( nDll ) RETURN
http://www.xHarbour.com