HasPBVisualObject
Description
Determines whether any PowerBuilder windows, visible or hidden,
are still in existence.
Syntax
|
1 |
HasPBVisualObject() |
Return value
pbboolean.
Returns true if any PowerBuilder windows are still alive. If any
windows that are not response windows are still alive, the PowerBuilder
application returns immediately unless you manually add a message
loop.
Examples
This example is similar to the example for RestartRequested, but
it includes a call to HasPBVisualObject that opens a message loop if the
return value is true:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
PBXRESULT PB_MyWinAppRunner::RunApplication() { PBXRESULT res; pbboolean restart = FALSE; do { res = StartApplication(); if (res == PBX_OK) // Process message dispatch { if ( GetSession()->HasPBVisualObject() ) { MSG msg; while ( GetMessage(&msg, 0, 0, 0) ) { TranslateMessage(&msg); DispatchMessage(&msg); if ( !GetSession()->HasPBVisualObject() ) break; } } } else break; restart = GetSession()->RestartRequested(); if (restart) RecreateSession(); } while (restart); return CleanApplication(); } |
Usage
RestartRequested and HasVisualPBObject are used in the
implementation of the IPB_VM RunApplication function. You no longer need
to use an external message loop to check for Windows messages when you
call the RunApplication function as you did in versions of PBNI prior to
PowerBuilder 10.5.
See also