DynaLib.Caller is a COM object providing a way to load a library and call its exported functions. It is particularly meant for VBScript clients (WSH/VBS) that need to utilize some functions of the Windows API.
DynaLib is designed as a simple yet easy to use tool. Of course, using it requires a good knowledge of function call conventions and data types. DynaLib is intended for script programmers who know what they're doing.
To call an external library function, create an instance of DynaLib.Caller and apply the CallFunc method:
Set obj = CreateObject("DynaLib.Caller") args = Array(String(1024, 0), Array(1024)) n = obj.CallFunc("Kernel32", "GetSystemWow64DirectoryW", args) If n Then MsgBox Left(args(0), n)
Set obj = CreateObject("DynaLib.Caller") args = Array("321abc132", "123") n = obj.CallFunc("Shlwapi", "StrTrimW", args) If n Then n = obj.CallFunc("Kernel32", "lstrlenW", Array(args(0))) MsgBox Left(args(0), n) End If
The method returns the function value. The two object properties ErrorCode and ErrorCodeAPI may return additional information. That's all.
DynaLib has some limitations but is applicable for the majority of Windows API functions.
DynaLib.Caller is provided as freeware and "as is" without any warranty or liability.
Please note that any usage is at your own risk!
DynaLib.Caller is supplied on the condition that you, the author of a client program or script, will use it with care and responsibility.
The file dynalib.zip contains the COM server DYNALIB.EXE along with documentation (DYNALIB.CHM).
Version status: 1.1, June 2019.
To install DynaLib, extract this content to a folder of your choice, then register the DynaLib COM object.
The registration will generally require administration rights. The recommended procedure is to open a console window ("Command Prompt") as Administrator, switch to the chosen folder, and enter the following instruction.
Please give attention to the program documentation.