Consultor Eletrônico



Kbase 18772: How to Call WIN32 API Function: SendMessage
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   4/22/1999
How to Call WIN32 API Function: SendMessage

DISCLAIMER:
===========
The code example in this knowledgebase is for informational purposes
only. If you have specific questions about which API calls would be
best suited to your design goals, please consult your Microsoft
documentation.

INTRODUCTION:
=============
The following sample code shows how to call the Win32 API function
called SendMessage. This function sends a message to another window
(widget) and waits for a response. The message bypasses the message
queue and is acted upon immediately.

This code has been tested on Windows NT 4.0 Workstation only.


&GLOBAL-DEFINE CB_SHOWDROPDOWN 335 /* Cause Combo-Box to Drop Down */

DEFINE VARIABLE intResult AS INTEGER NO-UNDO.

PROCEDURE SendMessageA EXTERNAL "USER32.DLL":
DEFINE INPUT PARAMETER hwnd AS LONG NO-UNDO.
DEFINE INPUT PARAMETER wmsg AS LONG NO-UNDO.
DEFINE INPUT PARAMETER wparam AS LONG NO-UNDO.
DEFINE INPUT PARAMETER lparam AS LONG NO-UNDO.
DEFINE RETURN PARAMETER rc AS LONG NO-UNDO.
END PROCEDURE.

/* The following statement assumes that you have a combo-box */
/* defined called combo-box-1. */

RUN SendMessageA (INPUT COMBO-BOX-1:HWND,
INPUT {&CB_SHOWDROPDOWN},
INPUT 1,
INPUT 0,
OUTPUT intResult).