Older Newer
Mon, 27 Dec 2021 09:02:11 . . . . SyneRyder [Note technical implementation details]


Changes by last author:

Added:
= getLibFn =

Requires FM 1.0 Beta 9.0 (April 2008) or newer

== Syntax ==

int getLibFn(void *dllHandle, char *functionName)

== Arguments ==

:dllHandle

::A handle (obtained with loadLib) to the DLL the function is in.

:functionName

::The name of the function to get a pointer to.

== Return ==

Returns a pointer to the DLL function.

== Description ==

Locates a specific function in a DLL, allowing you to call the function from within FilterMeister by using callLib.

Behind the scenes, this function is just a wrapper around the [GetProcAddress] Win32 API function.

== Example ==

<code>

// This code loads the user32.dll

// DLL included with Windows and

// uses it to display a YES/NO

// Message Box.

int* lib_user32;

int* functionPointer;

int returnval;

// Load the DLL library

lib_user32 = loadLib("user32");

if (lib_user32) {

// Get the function in the DLL

functionPointer = getLibFn(lib_user32, "MessageBoxA");

if (functionPointer) {

// Call the function

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

strcpy(str1, "Caption Text");

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

// Process return value

if (returnval == IDYES)

msgBox(MB_OK, "Yes!", "Yes was clicked");

if (returnval == IDNO)

msgBox(MB_OK, "No :(", "No was clicked");

}

else msgBox(MB_OK, "Error", "Function wasn't loaded");

// Free the library DLL

freeLib(lib_user32);

}

else msgBox(MB_OK, "Error", "DLL was not loaded");

</code>

== See Also ==

loadLib, callLib, freeLib

== Comments ==

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