ProcessPBMessage
Description
Checks the PowerBuilder message queue and, if there is a message
in the queue, attempts to process it.
Syntax
|
1 |
ProcessPBMessage() |
Return value
pbboolean.
Returns true if a PowerBuilder message was processed, and false
otherwise.
Examples
This message loop in a WinMain function processes a PowerBuilder
message if a message has been received and an IPB session is
running:
|
1 2 3 4 5 6 7 8 9 10 |
try { while (GetMessage(&msg, NULL, 0, 0)) { TranslateMessage(&msg); DispatchMessage(&msg); // Call to ProcessPBMessage if (session) session->ProcessPBMessage(); } |
This overloaded WindowProc function in an MFC application
processes a PowerBuilder message:
|
1 2 3 4 5 6 |
LRESULT CCallPBVCtrl::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) { d_session->ProcessPBMessage(); return CDialog::WindowProc(message, wParam, lParam); } |
Usage
Each time this function is called, it attempts to retrieve a
message from the PowerBuilder message queue and process it. It is
similar to the PowerBuilder Yield function; however, ProcessPBMessage
processes only one message at a time, and it processes only PowerBuilder
messages. The Yield function also processes Windows messages.
Use this function when PowerBuilder windows or visual controls are
called from C++ applications or from extensions to ensure that events
posted to the PowerBuilder message queue are processed.
If the function is not inserted in the C++ application in a way
that results in it being called repeatedly, posted events are not
processed in the PowerBuilder application.
For most applications, ProcessPBMessage can be inserted in a
message loop in the WinMain function. If you use Microsoft Foundation
Classes (MFC), you cannot modify the built-in message loop. To ensure
that the ProcessPBMessage function is called repeatedly, you can
overload the CWnd::WindowProc function and insert ProcessPBMessage into
the overloaded function.