IPB_Session interface:
RestartRequested method
Description
Determines whether the PowerBuilder system function Restart has been called.
Syntax
HasPBVisualObject()
Return Values
pbboolean. Returns true when the PowerBuilder system function Restart is called. When RestartRequested returns true, you should destroy the existing IPB_Session object and create a new one to restart the application.
Examples
In the following example, StartApplication, RecreateSession, and CleanApplication are functions of the PB_MyConsoleAppRunner class. StartApplication is similar to the IP_VM RunApplication function, but it uses an existing session. RecreateSession releases the current session and creates a new one. CleanApplication triggers the application's Close event and releases resources. In the example, RestartRequested is called in a DO loop to test whether the PowerBuilder Restart function has been called. If it has, the RecreateSession function is called:
PBXRESULT PB_MyConsoleAppRunner::RunApplication()
{
PBXRESULT res;
pbboolean restart = FALSE;
do
{
res = StartApplication();
if (res != PBX_OK)
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.