我的程序可以编译,但执行时出现内存不能读错误,按取消调试在
inline _variant_t::_variant_t(IDispatch* pSrc, bool fAddRef) throw()
{
V_VT(this) = VT_DISPATCH;
V_DISPATCH(this) = pSrc; // Need the AddRef() as VariantClear() calls Release(), unless fAddRef
// false indicates we're taking ownership
//
if (fAddRef) {
V_DISPATCH(this)->AddRef();//此处出现内存不能读的错误
}
}
的V_DISPATCH(this)->AddRef();语句处出现内存不能读的错误!如果单步调试,调试到CMy1App::InitInstance()中if (!ProcessShellCommand(cmdInfo)
)处开始不能继续单步调试,出现异常。请问这是为什么?
BOOL CMy1App::InitInstance()
{
// CG: The following block was added by the Splash Screen component. {
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
CSplashWnd::EnableSplashScreen(cmdInfo.m_bShowSplash);
}
AfxEnableControlContainer();
// Standard initialization
// If you are not using these features and wish to reduce the size
//  of your final executable, you should remove from the following
//  the specific initialization routines you do not need.#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif
// Change the registry key under which our settings are stored.
// TODO: You should modify this string to be something appropriate
// such as the name of your company or organization.
SetRegistryKey(_T("Local AppWizard-Generated Applications"));
LoadStdProfileSettings();  // Load standard INI file options (including MRU) // Register the application's document templates.  Document templates
//  serve as the connection between documents, frame windows and views.
CSingleDocTemplate* pDocTemplate;
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CMy1Doc),
RUNTIME_CLASS(CMainFrame),       // main SDI frame window
RUNTIME_CLASS(CMy1View));
AddDocTemplate(pDocTemplate);

// Parse command line for standard shell commands, DDE, file open
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
// Dispatch commands specified on the command line
if (!ProcessShellCommand(cmdInfo))\\在此处开始不能继续单步调试,出现异常
return FALSE;

// The one and only window has been initialized, so show and update it.
m_pMainWnd->ShowWindow(SW_SHOWMAXIMIZED);
m_pMainWnd->UpdateWindow();
return TRUE;
}谢谢了!