Older Newer
Fri, 05 Mar 2010 13:40:01 . . . . SyneRyder

Changes by last author:

= callLib =

== Syntax ==

:??? callLib(void *fnptr, ...)

== Arguments ==


::A pointer (obtained with getLibFn) to the DLL function to call.


::The other parameters required by the DLL function (varies depending on the function).

== Return ==

:Returns the return value of the called DLL function, which varies depending on the function called.

== Description ==

:Calls a function in a DLL that has previously been loaded with loadLib and getLibFn.

== Example ==


// This code loads the user32.dll DLL included with Windows and

// uses it to display a YES/NO Message Box.

int lib_user32, functionPointer, returnval;

lib_user32 = loadLib("user32");

if (!lib_user32) msgBox(MB_OK, "Error", "DLL was not loaded");

functionPointer = getLibFn(lib_user32, "MessageBoxA");

if (!functionPointer) msgBox(MB_OK, "Error", "Function wasn't loaded");

strcpy(str0, "The window text is here");

strcpy(str1, "Caption Text");

returnval = callLib(functionPointer, NULL, str0, str1, MB_YESNO);

if (returnval == IDYES) msgBox(MB_OK, "Yes!", "Yes was clicked");

if (returnval == IDNO) msgBox(MB_OK, "No :(", "No was clicked");



== Also see ==

:loadLib, getLibFn, freeLib

== Comments ==

:Everyone can add their comments about their experiences with this function here. Tips for using it are welcome, too.