AfxOleCanExitApp
指示应用程序是否可以停止。
BOOL AFXAPI AfxOleCanExitApp( );
返回值
非零,则应用程序退出;否则 0。
备注
如果具有对其对象的未处理引用,应用程序不应停止。 全局函数 AfxOleLockApp AfxOleUnlockApp 和递增和递减,引用单个计数器对应用程序的对象。 此计数器是非零时,应用程序不应停止。 如果计数器是非零,应用程序的主窗口隐藏 (不损坏),当用户从系统菜单选择关闭或退出从"文件"菜单中。 框架在 CFrameWnd::OnClose调用此函数。
示例
// Helper exit function for automation server
BOOL CMainFrame::CanExit()
{
if (AfxOleCanExitApp())
{
// No outstanding object counts - go ahead and exit
return TRUE;
}
else
{
// There are outstanding OLE object counts...
// hide app to give user impression that application has exited.
ShowWindow(SW_HIDE);
// take user out of control of the app
AfxOleSetUserCtrl(FALSE);
return FALSE;
}
}
要求
Header: <afxdisp.h>