Special

Introducing the “Welcome to Xojo” Bundle!

New to Xojo and looking for guidance? We've put together a terrific bundle to welcome you! Xojo Bundle

This bundle includes six back issues of the magazine -- all of year 21 in printed book and digital formats -- plus a one-year subscription (beginning with 22.1) so you'll be learning all about Xojo for the next year. It's the perfect way to get started programming with Xojo. And you save as much as $35 over the non-bundle price!

This offer is only available for a limited time as supplies are limited, so hurry today and order this special bundle before the offer goes away!

Article Preview


Buy Now

Issue 17.2 ('Barchart API')
Instant purchase and download via GumRoad!

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):

Download Icon 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 or link.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 example DynamicLoadDLLUnicode.xojo_binary_project project. Code for the MessageBoxA function is also included in DynamicLoadDLLANSI.xojo_binary_project.

The steps to create this example are:


Dynamically load the User32.dll library. This is where the API MessageBox function exists.


Get the address of the MessageBoxW function. Optionally, the MessageBoxA function address can also be retrieved.

...End of Excerpt. Please purchase the magazine to read the full article.