IPB_Session interface:
HasPBVisualObject method
Description
Determines whether any PowerBuilder windows, visible or hidden, are still in existence.
Syntax
HasPBVisualObject()
Return Values
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:
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.