Article Preview
Buy Now
FEATURE
Dynamic DLL's
Calling Windows DLL Functions Dynamically at Run-Time
Issue: 17.2 (March/April 2019)
Author: Eugene Dakin
Author Bio: Eugene works as a Senior Oilfield Technical Specialist. He has university degrees in the disciplines of Engineering, Chemistry, Biology, Business, and a Ph.D. in Chemical Engineering. He is the author of dozens of books on Xojo available on the xdevlibrary.com website.
Article Description: No description available.
Article Length (in bytes): 9,459
Starting Page Number: 22
Article Number: 17204
Resource File(s):
project17204.zip Updated: 2019-03-04 09:41:30
Related Link(s): None
Excerpt of article text...
Dynamic Link Libraries (DLL's) are the main components of reusable code on the Windows Operating System. There are many functions which can be viewed by using the
dumpbin.exe
orlink.exe
command-line tools. Xojo can dynamically load DLL's by using Windows API declare functions, and this example shows how to show a message with the Windows API MessageBox function.One of the many reasons for performing this task dynamically is to minimize memory usage by clearing the data after each call. On older systems this greatly helps performance, and lowers the memory needed to run API calls on business computers with many programs running in the background. This example can be used as a template for almost all of Windows DLL's, and also for exposed third-party DLL's.
This article shows how to dynamically call the
MessageBoxW
function in the accompanying exampleDynamicLoadDLLUnicode.xojo_binary_project
project. Code for theMessageBoxA
function is also included inDynamicLoadDLLANSI.xojo_binary_project
.The steps to create this example are:
Dynamically load theUser32.dll
library. This is where the API MessageBox function exists.
Get the address of theMessageBoxW
function. Optionally, theMessageBoxA
function address can also be retrieved.
...End of Excerpt. Please purchase the magazine to read the full article.