Debug Assertion in occcont.cpp Line: 926
Hi
I'm moving VC++ solution from VS 6 to VS 2005.
When application tries to load dialog with ocxes, follow error appears (on CDialog::DoModal() call):
Debug Assertion Failed!
Program: j:\nd_d\bin\are\AR_Pam.exe
File: f:\sp\vctools\vc7libs\ship\atlmfc\src\mfc\occcont.cpp
Line: 926
For information on how your program can cause an assertion
failure, see the Visual C++ documentation on asserts.
(Press Retry to debug the application)
Even if I try to place only one activex (e.g. some microsoft's one) onto dialog, error appears.
Some other projects from solution working ok but i can't find out what can cause such difference.
I'm using VS2005 SP1. AfxEnableControlContainer is called from CWinApp InitInstance
Please advice.
Thanks
Re: Debug Assertion in occcont.cpp Line: 926
Well, do what this "Assertion failed..." dialog recommends yo to:
Press Retry to debug the application, step into the source code and see the code/comments at the Line: 926 and some lines above it.
Re: Debug Assertion in occcont.cpp Line: 926
Thank you, Victor.
I've reviewed occcont.cpp and found that
HWND hwndCtrl=AfxGetDlgItemStartFromHWND(pOccDlgInfo->m_pItemInfo[i].nId, hwndSearchFrom);
returns 0.
There is comment also:
//If not found, revert to prev method of GetDlgItem, this means Win32 children list and resource item array are out of sync
But I don't understand what should I do to fix this 'out of sync'.
Does it mean *.rc file should store controls in same order as resource.h ?
Re: Debug Assertion in occcont.cpp Line: 926
Sorry, I don't know the reason: perhaps, something is wrong with one or more OCX controls in your VS2005 build?
And no, .rc file does NOT need to store controls in same order as resource.h (except in some rare cases as radio buttons in the group)
Re: Debug Assertion in occcont.cpp Line: 926
OCX'es are Ok. They are working in other project.
Generally it looks like problem is in some other place then in FillListSitesOrWnds (occcont.cpp).
Ocx are just not created:
GetWindow(..,GW_HWNDNEXT) 'jumps' over them.
Re: Debug Assertion in occcont.cpp Line: 926
I've dug deeper and found that error caused by OleInitialize fail (OleInitialize returned scode = RPC_E_CHANGED_MODE).
I've tried to find out where COINIT_MULTITHREADED model is set but can't find this place.
Can anybody advice how can it be set if nobody calls CoInitializeEx?
Re: Debug Assertion in occcont.cpp Line: 926
Hi Guys!
I'v the same problem, and I can't debug my application, does anyone kwon a kind of solution?
In msdn network I found that article:
http://support.microsoft.com/kb/949107
But I don't understand the real problem that mak ethe assertion... is only an ocx control unregisterd?
Best Regards
Franco Tampieri
Re: Debug Assertion in occcont.cpp Line: 926
Quote:
Originally Posted by
dr.dran
No, not "unregisterd". I seems to be "not registered"! From this article:
Quote:
This problem can occur when the ActiveX controls are not properly registered on the deployment machine.
So the first thing you should do is
Quote:
Resolution
Register ActiveX controls using regsvr32.exe.
Re: Debug Assertion in occcont.cpp Line: 926
Franco walter melon, you should stop messing your stupid ideas around. Stimulate Gal-spot, beating around the bush instead of the main one, you don't see your lack of debug and sourly bad-looking face of the GUI after all ? I only see your mouth and tongue all over one or two places to lick the secreted fluid of the debugg machine :D
Re: Debug Assertion in occcont.cpp Line: 926
It is not stupid, it is a problem with register, I am glad you see the online strategies :D
Re: Debug Assertion in occcont.cpp Line: 926
Hi guys!
I'm of the same idea of yuenqi.
@ Thu! Please don't bugging or trolling me, but suggest me a solution :P :D
I'm new of the vc++ studiointerface debug, can you suggest me if there is a function to show me the ocx dependencies or whatelse?
@VictorN I tryed to registe alla the ocx present in the program, but the result si the same, I can compile the program, but i can't debug it... grr very nasty!
Cheers
Franco
Re: Debug Assertion in occcont.cpp Line: 926
Quote:
Originally Posted by
dr.dran
@VictorN I tryed to registe alla the ocx present in the program, but the result si the same, I can compile the program, but i can't debug it... grr very nasty!
Sorry! I avoid using third party ActiveX controls since the last at least six years. So I don't have any experience with solving such "register"-problems. :sick:
Re: Debug Assertion in occcont.cpp Line: 926
Hi at all!
I found that the assert error is on that line:
{ return CreateControl(GetClsid(), lpszWindowName, dwStyle, rect, pParentWnd, nID,
pPersist, bStorage, bstrLicKey); }
in the file msflexgrid.h
Anyone have experience on it?
Best regards
Franco
Re: Debug Assertion in occcont.cpp Line: 926
Quote:
Originally Posted by
dr.dran
Hi at all!
I found that the assert error is on that line:
{ return CreateControl(GetClsid(), lpszWindowName, dwStyle, rect, pParentWnd, nID,
pPersist, bStorage, bstrLicKey); }
in the file msflexgrid.h
But you wrote in your OP it was in occcont.cpp:
Quote:
Originally Posted by
starcevas
Hi
I'm moving VC++ solution from VS 6 to VS 2005.
When application tries to load dialog with ocxes, follow error appears (on CDialog::DoModal() call):
Debug Assertion Failed!
Program: j:\nd_d\bin\are\AR_Pam.exe
File: f:\sp\vctools\vc7libs\ship\atlmfc\src\mfc\occcont.cpp
Line: 926
For information on how your program can cause an assertion
failure, see the Visual C++ documentation on asserts.
(Press Retry to debug the application)
So WHERE is the ASSERT statement that failed? What is the statement asserted? What are any comments around this ASSERT?
What does the GetClsid() return?
What are the values of other parameters passed in CreateControl?
Re: Debug Assertion in occcont.cpp Line: 926
Hi Victorn!
Well, I try do debug and isolate the problem in the code, and I place some brakepoint to block the program before the assertion.
If I run that string then the debugger give me the message in object in this forum.
I found that the parameters bstrLicKey that was a BSTR return me a bad pointer, but before is initialized to null...
this i s the string before used to give a default parameter to the funciont...
BOOL Create(LPCTSTR lpszWindowName, DWORD dwStyle,
const RECT& rect, CWnd* pParentWnd, UINT nID,
CFile* pPersist = NULL, BOOL bStorage = FALSE,
BSTR bstrLicKey = NULL)
The joke is that if I compile for release the program compile wiwhout an error... grrrrrr
Best Regards
Franco
Re: Debug Assertion in occcont.cpp Line: 926
You still haven't answered my questions. Why? :confused:
Quote:
Originally Posted by
dr.dran
The joke is that if I compile for release the program compile wiwhout an error... grrrrrr
Why "grrrrrr"? :confused:
It is a standard behavior! ASSERT macro is ignored (it is designed to be ignored) in the Release build. Therefore you don't see any message box, although the same problem (as displayed in the message box in debug build) still exists.
Re: Debug Assertion in occcont.cpp Line: 926
Quote:
Originally Posted by
VictorN
But you wrote in your OP it was in occcont.cpp:
So WHERE is the ASSERT statement that failed? What is the statement asserted? What are any comments around this ASSERT?
What does the GetClsid() return?
What are the values of other parameters passed in CreateControl?
Thi is the value passed to the Create Control:
bStorage 0 int
bstrLicKey 0x00000000 <Bad Ptr> wchar_t *
dwStyle 268500992 unsigned long
lpszWindowName 0x004c1bfd "" const char *
nID 1704 unsigned int
pParentWnd 0x01c3dff0 {CXProgView hWnd=0x000a0722} CWnd *
pPersist 0x00000000 {hFile=??? name=???} CFile *
rect {top=218 bottom=22 left=149 right=246} const tag
There isn't any comment in the assert statement...
Best regards
Franco Tampieri
Re: Debug Assertion in occcont.cpp Line: 926
Quote:
Originally Posted by
dr.dran
Thi is the value passed to the Create Control:
bStorage 0 int
bstrLicKey 0x00000000 <Bad Ptr> wchar_t *
dwStyle 268500992 unsigned long
lpszWindowName 0x004c1bfd "" const char *
nID 1704 unsigned int
pParentWnd 0x01c3dff0 {CXProgView hWnd=0x000a0722} CWnd *
pPersist 0x00000000 {hFile=??? name=???} CFile *
rect {top=218 bottom=22 left=149 right=246} const tag
There isn't any comment in the assert statement...
Best regards
Franco Tampieri
What is "Create Control"? :confused:
And the third time:
Quote:
Originally Posted by Victor
WHERE is the ASSERT statement that failed? What is the statement asserted?
Note, that I don't have VS2005 installed (only VS2008 and VS6) so I hove no idea what the code around this ASSERT is. Please, post it (don't forget to use Code tags around the code snippet).
Anyway, the problem seems to be the non-correct CLSID of your control (see CreateControl documentation).
Re: Debug Assertion in occcont.cpp Line: 926
I've been having a similar problem. A project originally working in Visual C++ 6 has been converted to Visual Studio 2005, and I receive the assertion fault when opening an Active-X instrument attached to a dialog box. Would love to upgrade to Visual Studio 2008 but I'm stuck with an older version of National Instruments Measurement Studio.
This is the segment from "occont.cpp" *Edit... the failing Assert statement is the last statement in this code chunk.
Code:
//First time start searching from first z-order, else
//search from 1 after the previous window.
HWND hwndSearchFrom= (hwndStart == NULL) ?
GetWindow(m_pWnd->GetSafeHwnd(),GW_CHILD) :
::GetWindow(hwndStart,GW_HWNDNEXT);
HWND hwndCtrl=AfxGetDlgItemStartFromHWND(pOccDlgInfo->m_pItemInfo[i].nId, hwndSearchFrom);
//If not found, revert to prev method of GetDlgItem, this means Win32 children list and
//resource item array are out of sync
if (hwndCtrl == NULL)
{
hwndCtrl = ::GetDlgItem(m_pWnd->GetSafeHwnd(),pOccDlgInfo->m_pItemInfo[i].nId);
TRACE(traceAppMsg, 0, "Warning: Resource items and Win32 Z-order lists are out of sync. Tab order may be not defined well.\n");
}
COleControlSiteOrWnd *pTemp =
new COleControlSiteOrWnd(
hwndCtrl,
pOccDlgInfo->m_pItemInfo[i].bAutoRadioButton);
ASSERT(IsWindow(pTemp->m_hWnd));
This is the calling code. The failure occurs at "pPanel->Create(IDD_DIGITAL_CONTROL, &parent);
Code:
bool DigitalOutput::VirtCreatePanel(CWnd & parent, CRect const & rc, CExcel *Excel, int row)
{
bool current = MB[varName]->IsSet(bit);
pPanel = new CDigitalControl(signal,this, current, &parent);
if(!IsWindow(parent.GetSafeHwnd()))
return false;
pPanel->Create(IDD_DIGITAL_CONTROL,&parent);
pPanel->MoveWindow(&rc);
pPanel->ShowWindow(SW_SHOW);
return true;
}
This is the line called from afxwin2.inl
Code:
// CDialog
_AFXWIN_INLINE BOOL CDialog::Create(UINT nIDTemplate, CWnd* pParentWnd)
{ return CDialog::Create(ATL_MAKEINTRESOURCE(nIDTemplate), pParentWnd); }
Thank you in advance for any assistance you can provide.
Andrew
Re: Debug Assertion in occcont.cpp Line: 926
Fixed the problem here.
Changed the InitATL() to AfxOleInit()
Code:
//Under the applications ::InitInstance()
// if (!InitATL())
// return FALSE;
if (!AfxOleInit())
return FALSE;
Additional Information:
I created a Release version to circumvent the assertion fault, and the actual instrument image would not show up on my dialogue box.
Re: Debug Assertion in occcont.cpp Line: 926
Quote:
Originally Posted by
Televiper
I created a Release version to circumvent the assertion fault...
Fantastic, I'm going to have to introduce this great idea at my work.
Re: Debug Assertion in occcont.cpp Line: 926
Quote:
Originally Posted by
STLDude
Fantastic, I'm going to have to introduce this great idea at my work.
If after doing that, you need a job, I think we may have a couple of openings.
Regards,
Paul McKenzie