我以前的一个在Windows2000上运行了三年的VC程序,现在放在WindowsXP上运行,经常在执行RunEmbedded()或RunAutomated()时会出问题,导致程序自动退出,但并不是每一次都会出问题。BOOL CExplorerSysApp::InitInstance()
{
// Initialize OLE libraries
if (!AfxOleInit())
{
AfxMessageBox(IDP_OLE_INIT_FAILED);
return FALSE;
} ...... // Parse the command line to see if launched as OLE server
if (RunEmbedded() || RunAutomated()) //出问题的地方
{
// Register all OLE server (factories) as running. This enables the
// OLE libraries to create objects from other applications.
COleTemplateServer::RegisterAll();
}1. RunEmbedded()中出问题的具体地方在自动调用的SafeSetProperty()中
BOOL AFX_CDECL COleControlSite::SafeSetProperty(DISPID dwDispID, VARTYPE vtProp, ...)
{
va_list argList; // really only one arg, but...
va_start(argList, vtProp); BOOL bSuccess; TRY
{
SetPropertyV(dwDispID, vtProp, argList); //出问题的地方
bSuccess = TRUE;
}2. RunAutomated()中出问题的具体地方如下
BOOL CWinApp::RunAutomated()
{
ASSERT(m_lpCmdLine != NULL); //出问题的地方不知有谁碰到并解决此问题?
{
// Initialize OLE libraries
if (!AfxOleInit())
{
AfxMessageBox(IDP_OLE_INIT_FAILED);
return FALSE;
} ...... // Parse the command line to see if launched as OLE server
if (RunEmbedded() || RunAutomated()) //出问题的地方
{
// Register all OLE server (factories) as running. This enables the
// OLE libraries to create objects from other applications.
COleTemplateServer::RegisterAll();
}1. RunEmbedded()中出问题的具体地方在自动调用的SafeSetProperty()中
BOOL AFX_CDECL COleControlSite::SafeSetProperty(DISPID dwDispID, VARTYPE vtProp, ...)
{
va_list argList; // really only one arg, but...
va_start(argList, vtProp); BOOL bSuccess; TRY
{
SetPropertyV(dwDispID, vtProp, argList); //出问题的地方
bSuccess = TRUE;
}2. RunAutomated()中出问题的具体地方如下
BOOL CWinApp::RunAutomated()
{
ASSERT(m_lpCmdLine != NULL); //出问题的地方不知有谁碰到并解决此问题?
是否嵌入的?是否自动的?
谁能帮我翻译一下:
Call this function to determine whether the "/Automation" or "-Automation" option is present, which indicates whether the server application was launched by a client application.