Examples of static access to a shared library
- Last Updated: January 17, 2024
- 2 minute read
- OpenEdge
- Version 12.8
- Documentation
The following examples show several variations on the
use of the PROCEDURE and DEFINE PARAMETER statements
for static access to a shared library.
In this example, the ABL MESSAGE statement displays a
message in an alert box. It then calls the MessageBoxA routine
from user32.dll to display the same message
in an identical alert box, as shown:
i-dllex1.p
|
The following procedure uses the sndPlaySoundA routine
from winmm.dll. The procedure allows the user
to select a sound to play and then invokes the DLL routine to play
the sound. The DLL routine takes two input parameters and returns
a status code, as shown:
i-dllex2.p
|
The following code sample demonstrates calling the C library
function atoi to get the value of the character
form of an integer:
|
The declaration of the C function being called looks like this:
|
The following procedure defines and displays a shaded ellipse
in the current window using DLL functions from the Windows graphics
library. This requires initialization of a small structure (ElipRegion).
Note that ABL has no knowledge of any graphics that you create using DLLs. You must ensure that ABL does not refresh the window you are using while the graphics are displayed. Otherwise, the graphics disappear during a window system refresh. (You can help to mitigate this by providing a graphics refresh option within your OpenEdge application.) The i-dllex3.p procedure displays a preparatory message ("Preparing drawing"), and pauses to realize the current window before calling the DLL routines that display the filled ellipse. The procedure pauses by default before it terminates, allowing the ellipse to remain on the display, as shown:
i-dllex3.p
|