Kbase P100869: A sample code of how to get a return value from a DLL.
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  04/10/2005 |
|
Status: Unverified
GOAL:
How to get a return value from a DLL.
GOAL:
How to use the MessageBoxA routine from user32.dll to display a message.
FIX:
The following procedure uses the Progress MESSAGE statement to display 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 and save the returned value into a variable:
DEFINE VARIABLE result AS INTEGER.
MESSAGE " It's a whole new world!"
VIEW-AS
ALERT-BOX MESSAGE
BUTTONS OK
TITLE "Progress DLL Access".
RUN MessageBoxA (0, " It's A Whole New World!",
"Progress DLL Access - from the DLL!", 0, OUTPUT result).
MESSAGE "DLL retruned " RESULT
VIEW-AS ALERT-BOX INFO BUTTONS OK.
PROCEDURE MessageBoxA EXTERNAL "user32.dll":
DEFINE INPUT PARAMETER hwnd AS LONG.
DEFINE INPUT PARAMETER mbtext AS CHARACTER.
DEFINE INPUT PARAMETER mbtitle AS CHARACTER.
DEFINE INPUT PARAMETER style AS LONG.
DEFINE RETURN PARAMETER result AS LONG.
END.