I am having strange problem with my project. I have installed the V2.25 latest patch and use VC++ 7.10.
I get assert ERROR in the follwoing line of the code (file is winfrm.cpp). This happens only if I create certain COM Objects in my project. There is a function in my code to instantiate these COM objects. If I bypass these lines, I see no issues . Any idea where it is coming from ?
Thanks in advance.
Saroj
BOOL CFrameWnd::LoadAccelTable(LPCTSTR lpszResourceName)
{
ASSERT(m_hAccelTable == NULL); // only do once
ASSERT(lpszResourceName != NULL);
HINSTANCE hInst = AfxFindResourceHandle(lpszResourceName, RT_ACCELERATOR);
m_hAccelTable = ::LoadAccelerators(hInst, lpszResourceName);
return (m_hAccelTable != NULL);
}
Function to instantiate the COM objects....
BOOL CMainFrame::InitializeVisionSystem()
{
HRESULT retVal;
try
{
// Initialize the COM library
// retVal = CoInitialize(NULL);
// if( !((retVal == S_FALSE) || (retVal == S_OK )) ) // If not previously initialized or Initialization fails,
// return(FALSE); // return FALSE
retVal = pApplication.CreateInstance(_T("MIL.Application"));
if(!ErrorDescription(retVal))
return(FALSE);
pSystem = pApplication->CreateObject(_T("MIL.System"), FALSE);
pDigitizer = pApplication->CreateObject(_T("MIL.Digitizer"), FALSE);
pDigitizer->OwnerSystem = pSystem;
if(blnOFFLineVersion)
pSystem->SystemType = _T("VGA");
else
pSystem->SystemType = _T("Meteor_II");
pSystem->Allocate();
Wait(1000);
// Only allocate the digitizer if it is supported
if ((pSystem->NumberOfDigitizers != 0) && (!pDigitizer->IsAllocated))
{
pDigitizer->Allocate();
}
pImageProcessing = pApplication->CreateObject(_T("MIL.ImageProcessing"), FALSE);
pImageProcessing->OwnerSystem = pSystem;
pImageProcessing->Allocate();
}
catch(COleDispatchException* pException)
{
CString CErrorMessage;
CErrorMessage = pException->m_strDescription;
CErrorMessage = CErrorMessage + _T("\n");
CErrorMessage = CErrorMessage + pException->m_strSource;
AfxMessageBox(CErrorMessage, MB_OK, 0);
pException->Delete();
return(FALSE);
}
catch(...)
{
CString CErrorMessage;
CErrorMessage.LoadString(IDS_UNHANDLED_EXCEPTION);
AfxMessageBox(CErrorMessage, MB_OK, 0);
return(FALSE);
}
return(TRUE);
}