Assume the following applet structure: //假设如下应用结构。typedef struct _bgApp{AEEApplet a;boolean m_bGoBg; // used to toggle whether to run in background mode,后台运用的标志状态。} bgApp;Model event handling for a background application: //后台运用的事件处理模型switch (eCode){case EVT_APP_START:if(pMe->m_bGoBg)ISHELL_CloseApplet(pMe->a.m_pIShell, FALSE); // send applet to backgroundreturn TRUE;case EVT_APP_STOP:if(pMe->m_bGoBg)*((boolean*) dwParam) = FALSE; // set dwParam to run in bg ,后台运行了return TRUE;case EVT_USER:if(pMe->m_bGoBg){pMe->m_bGoBg = FALSE;// make applet active,激活运用...ISHELL_StartApplet(pMe->a.m_pIShell, AEECLSID_BGAPP); }else{pMe->m_bGoBg = TRUE;// trigger EVT_APP_STOP to send app to backgroundISHELL_CloseApplet(pMe->a.m_pIShell, FALSE); }return TRUE;} 应用程序可以通过evt_user 事件,可以将应用设置为后台应用或者激活应用;这些事件可以由其他应用通过ISHELL_SendEvent() 或者 ISHELL_PostEvent()函数来发送。在这个执行处理中,evt_user事件只是将应用本身在后台和前台之间作切换作用。更复杂的行为处理可以通过检测dwParam参数的值进行处理,这个值是由应用程序分发时间传递来的。如果应用程序直接由brew应用管理器启动,m_bGoBg的初始化值将决定是否在后台运行。