Step 5: Startup/Shutdown
Last updated on: 5/16/2013 3:10 PM
Created on: 3/21/2014 2:18 PM
The System Core 7 framework requires all applets to have minimal user interface requirements and respond primarily to behind the scenes invocation such as the inter-process command line handling. Because start up and shutdown are commonly associated with an application or service, methods related to handling start up and shut down are handled by a different part of the framework that is responsible for the frameworks execution life cycle. Enabling startup and shutdown functionality is done easily by having our applet implement the ISCSystemTrayExtension() interface. Once this is done we must also implement three important methods that are marked as pure virtual by the interface: OnSystemTrayCreate(), OnSystemTrayStart() and OnSystemTrayStop().
Resources that will be required for the applet to run should be allocated in the OnSystemTrayCreate() method. Likewise, any resources allocated that need to be released back to the system should be done in the OnSystemTrayDestroy() method. Each of this methods is called only once during the lifecycle of the framework instance, and are only called from the master instance of the framework. Thus, it is safe to assume that create will be invoked once followed by a destroy.
The framework will call the OnSystemTrayStart() method when the master instance has finished its creation steps and is ready to run. This method will also be called any time the system resumes from a state of hibernation in which the framework is still running. Check the nReason parameter to determine the situation in which the framework is invoking this method. A query method CanSystemTrayShutdown() is called when the framework is told by the OS that it is about to be suspended or the user has selected to close the framework application. Returning the value true from this method will allow the framework to carry out the stop requests, however if an applet is still performing an operation and the system should not be halted, return false. This will have the framework signal an abort to the suspend/shutdown request. If all the applets determine that it is safe to shut down the framework calls OnSystemTrayStop() with the nReason parameter specifying why the applet is being stopped.
With the addition of this interface and the implementation of these methods our demo applet can now respond to the various start-up and shutdown requests that will occur during the execution lifecycle.
TopicsDeveloper's Historical Persepctive Why A Platform Standards The User Experience
InterfacesISCApplet ISCTaskListExtension ISCConfigPanelExtension ISCErrorReporterExtension ISCLogConnector/ISCLogEntry ISCCertificateStoreExtension ISCSystemTrayExtension ISCAppletWindowExtension ISCSecureObjectExtension
Applet Building StepsStep 1: Create The Applet Step 2: Adding Action Items Step 3: Adding Configuration Panels Step 4: Adding Custom Error Text Step 5: Startup/Shutdown Step 6: Adding Main Window Support Step 7: Adding Obejct Window Support