Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Difference in generated wrappers for OCXs in vs2003 and vs2005?

431 views
Skip to first unread message

Sharon

unread,
Jan 9, 2006, 9:58:02 PM1/9/06
to
Visual Studio can generate .h and .cpp files for MFC classes based on an OCX.
In VS2003 this is done by Project->Add Class->MFC->MFC Class From ActiveX
Control.

I'm upgrading from VS2003 to VS2005 and am encountering a runtime assert. I
have re-compiled the OCX using VS2005 but have not regenerated the files
using the VS2005 tool though. Does this matter? Has this changed from
VS2003 to VS2005?

Actually, the problem I'm having is exactly like this guy:

http://groups.google.ca/group/microsoft.public.vc.mfc/browse_thread/thread/bc46fc6fcaabd03f/f281d9152b08be14?lnk=st&q=assert+occcont.cpp&rnum=1&hl=en#f281d9152b08be14

Is the z-order a problem somehow??


Thanks
Sharon

TerryFei

unread,
Jan 10, 2006, 3:25:11 AM1/10/06
to
Hi Sharon,
Welcome to MSDN Newsgroup!

Based on the current situation, please help me to confirm what the version
of your VS2005 is. On our side, VS2005 is RTM version. After our testing,
we could generate files using VS2005 and there is no a runtime assert error
when upgrading from VS2003 to VS2005.
So in this scenario, I hope you could send me a simplified sample (VS2003)
and I will upgrade it using VS2005 to repro this issue. It will help us get
closer to this issue, so I appreciate your time in performing them.

If you have any questions, please feel free to join the community and we
are here to support you at your convenience. Thanks for your understanding!

Best Regards,

Terry Fei [MSFT]
Microsoft Community Support
Get Secure! www.microsoft.com/security

Sharon

unread,
Jan 11, 2006, 8:29:02 PM1/11/06
to
Hey Terry!

Thanks for the welcome and getting back to me!! I've been trying to create
a simplified version of the problem, but it is quite hard because our system
is very complex. I will keep working on it, but in the meantime, I did do
some digging so maybe this info can help...

I am using the RTM version of VS2005 (8.0.50727.42).

The assert happens in a MFC file that was changed from VS2003. It looks
like Microsoft added a corner-case bug fix in the code, and that's where my
runtime assert is happening.

The vs2003 file is:
C:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\atlmfc\src\mfc\occcont.cpp

The vs2005 equivalent is:
C:\Program Files\Microsoft Visual Studio 8\VC\atlmfc\src\mfc\occcont.cpp

If you compare the two files, CWnd::InitControlContainer() was given a new
(useless) parameter so that it always calls:

//When Container is created and it is not during creation from resources,
//populate the list with all resource created Win32 controls.
if (!bCreateFromResource)
{
m_pCtrlCont->FillListSitesOrWnds(GetOccDialogInfo());
}

Defined in the same file, COleControlContainer::FillListSitesOrWnds() is a
brand new method, probably added to fix a particular customer escalation.
The assert happens in this methed on the line

ASSERT(IsWindow(pTemp->m_hWnd));

and the following warning is sent to the output:

Warning: Resource items and Win32 Z-order lists are out of sync. Tab order
may be not defined well.


During runtime, if I ignore all these asserts, everything seems to work
fine. However, I can't leave these asserts in the build.

Can you please tell me what defect this new code was supposed to solve? Or
what condition I am now violating, since it is more strict in vs2005 than in
vs2003?

Thanks!!
Sharon


BTW, my problem looks EXACTLY like this other guy's problem:

http://groups.google.ca/group/microsoft.public.vc.mfc/browse_thread/thread/bc46fc6fcaabd03f/f281d9152b08be14?lnk=st&q=assert+occcont.cpp&rnum=1&hl=en#f281d9152b08be14

TerryFei

unread,
Jan 11, 2006, 9:29:46 PM1/11/06
to
Hi Sharon,
Thanks for your response to make me clear to this issue!:)

This is a bug. The HWND property needs to be removed from the problem
controls.
Here is what is happening. In VC6, if you select all of the stock
properties, we spit out a PROP_ENTRY for HWND. This is bad as the HWND
property is read-only and a PROP_ENTRY causes us to serialize that
property. When we try to reload that stream, we fail setting the HWND
property because it is read-only(It will cause an assertion failure, see
the Visual C++ documentation on asserts: ASSERT(IsWindow(pTemp->m_hWnd));)
There is no real way to fix this on the container side as the control's
code is what handles the writing and reading of the stream.
VC2003 and Whidbey do not create a PROP_ENTRY for the HWND property, so
this doesn't happen.
Note an ActiveX control compiled with Visual C++ 6.0 when embedded in a
dialog box in a project developed with Visual C++ 2005 may cause your
program to assert at runtime. In this situation, recompile the ActiveX
control using Visual C++ 2005.

Thanks for you feedback and we will make this into a doc bug. If you have
any questions, please feel free to let me know Thanks for your

Sharon

unread,
Jan 13, 2006, 1:24:02 PM1/13/06
to
Hello Terry!

Actually, we have not selected all the stock properties and I cannot find
any PROP_ENTRY in the code. The problem must be something else... I have
actually openned up a Microsoft Support Incident and someone from India is
handling the case. I sent him a solution that shows our problem and I think
he will defer to the MFC development team. Are you part of the development
team? Maybe you'll see the code! :)

Thanks,
Sharon

TerryFei

unread,
Jan 15, 2006, 8:57:44 PM1/15/06
to
Hi Sharon,
Nice to hear from you! :)

Would you tell me the case id? So I could help you track this case and tell
you latest state of it.

If you have any questions, please feel free to let me know Thanks for your
understanding!

Best Regards,

Terry Fei [MSFT]
Microsoft Community Support
Get Secure! www.microsoft.com/security


--------------------
>Thread-Topic: Difference in generated wrappers for OCXs in vs2003 and
vs2005
>thread-index: AcYYbocCr6VOoVP9RqmAqJrPSiKHYg==
>X-WBNR-Posting-Host: 192.25.142.225
>From: =?Utf-8?B?U2hhcm9u?= <vb...@community.nospam>
>References: <7E5251EA-F1B4-4293...@microsoft.com>
<fCXkl9bF...@TK2MSFTNGXA02.phx.gbl>
<7C06A446-AEAF-4CB3...@microsoft.com>
<ibZnTAyF...@TK2MSFTNGXA02.phx.gbl>
>Subject: RE: Difference in generated wrappers for OCXs in vs2003 and vs2005
>Date: Fri, 13 Jan 2006 10:24:02 -0800
>Lines: 45
>Message-ID: <D71EB7E3-DD1A-429B...@microsoft.com>
>MIME-Version: 1.0
>Content-Type: text/plain;
> charset="Utf-8"
>Content-Transfer-Encoding: 7bit
>X-Newsreader: Microsoft CDO for Windows 2000
>Content-Class: urn:content-classes:message
>Importance: normal
>Priority: normal
>X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
>Newsgroups: microsoft.public.vc.mfcole
>NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
>Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGXA03.phx.gbl
>Xref: TK2MSFTNGXA02.phx.gbl microsoft.public.vc.mfcole:31634
>X-Tomcat-NG: microsoft.public.vc.mfcole

Sharon

unread,
Jan 16, 2006, 6:36:04 PM1/16/06
to
Hi Terry!

Thanks for helping to look into this too! This is really good timing
because I my correspondent in India has the day off...

The case ID is SRX060112603946.

I had sent him a small test program, and the code necessary to compile two
of our ActiveX controls. One ActiveX control, PhysicalLayer, contains
another ActiveX control as a tab, VSRLayer. The test program can be a MFC
Dialog that pops-up the PhysicalLayer OCX.

I am dynamically creating the ActiveX controls in the virtual OnCreate()
methods. A solution was proposed (see below) but this solution doesn't work
for me. I get the following error in the Debugger Output window:

Warning: constructing COleException, scode = DISP_E_MEMBERNOTFOUND
($80020003).

First-chance exception at 0x7c81eb33 in StillAProblem.exe: Microsoft C++
exception: COleException at memory location 0x0012de64.

---------------- Suggested Solution -----------------
I can repro the symptoms by dynamically creating an activex control in the
OnCreate of a dialog in a dialog based MFC application.

This is not recommended place to create an activex control.

The MFC code tries to access/iterate through the non-activex controls on the
dialog and this is leading to the failure since these controls are not fully
create in the context of OnCreate().

Note: Checking is strict in VC8 that is the reason why it worked when
compiled using VS 2003, though it is not suggested to create controls in
OnCreate().

They will fully create in the context OnInitDialog().

So workaround is to create the activex control in OnInitDialog.
On a dialoag -> Create in OnInitDialog
On a formview -> Create in OnInitialUpdate
On other CView derived classes -> Create in OnInitialUpdate
---------------------------------------------------------

Thanks for your input!

TerryFei

unread,
Jan 18, 2006, 1:47:34 AM1/18/06
to
Hi Sharon,
Thanks for your feedback! :)

I've forward your request to the support engineer, who is dealing with your
case now. If I have any reply, I'll inform of you as soon as possible.
Thanks for your understanding!

Best Regards,

Terry Fei [MSFT]
Microsoft Community Support
Get Secure! www.microsoft.com/security


--------------------
>Thread-Topic: Difference in generated wrappers for OCXs in vs2003 and
vs2005

>thread-index: AcYa9Z3pmU3SuhsLQ0WxAhxtdftXTA==


>X-WBNR-Posting-Host: 192.25.142.225
>From: =?Utf-8?B?U2hhcm9u?= <vb...@community.nospam>
>References: <7E5251EA-F1B4-4293...@microsoft.com>
<fCXkl9bF...@TK2MSFTNGXA02.phx.gbl>
<7C06A446-AEAF-4CB3...@microsoft.com>
<ibZnTAyF...@TK2MSFTNGXA02.phx.gbl>

<D71EB7E3-DD1A-429B...@microsoft.com>
<lcg4GBkG...@TK2MSFTNGXA02.phx.gbl>


>Subject: RE: Difference in generated wrappers for OCXs in vs2003 and vs2005

>Date: Mon, 16 Jan 2006 15:36:04 -0800
>Lines: 146
>Message-ID: <B7DB5122-E543-4191...@microsoft.com>


>MIME-Version: 1.0
>Content-Type: text/plain;
> charset="Utf-8"
>Content-Transfer-Encoding: 7bit
>X-Newsreader: Microsoft CDO for Windows 2000
>Content-Class: urn:content-classes:message
>Importance: normal
>Priority: normal
>X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
>Newsgroups: microsoft.public.vc.mfcole
>NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
>Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGXA03.phx.gbl

>Xref: TK2MSFTNGXA02.phx.gbl microsoft.public.vc.mfcole:31639
>X-Tomcat-NG: microsoft.public.vc.mfcole

Sharon

unread,
Jan 18, 2006, 3:43:26 PM1/18/06
to
Yay, my problem is solved!! My support engineer has solved my problem!!
Thanks so much everyone!!

TerryFei

unread,
Jan 18, 2006, 9:30:34 PM1/18/06
to
Hi Sharon,
I am glad to know the issue has been resolved. :)
It's my pleasure to work with you.

Best Regards,

Terry Fei [MSFT]
Microsoft Community Support
Get Secure! www.microsoft.com/security

--------------------
>Thread-Topic: Difference in generated wrappers for OCXs in vs2003 and
vs2005

>thread-index: AcYcb9S5hJsitebxSDa+xTn2NKoiSQ==


>X-WBNR-Posting-Host: 192.25.142.225
>From: =?Utf-8?B?U2hhcm9u?= <vb...@community.nospam>
>References: <7E5251EA-F1B4-4293...@microsoft.com>
<fCXkl9bF...@TK2MSFTNGXA02.phx.gbl>
<7C06A446-AEAF-4CB3...@microsoft.com>
<ibZnTAyF...@TK2MSFTNGXA02.phx.gbl>
<D71EB7E3-DD1A-429B...@microsoft.com>
<lcg4GBkG...@TK2MSFTNGXA02.phx.gbl>

<B7DB5122-E543-4191...@microsoft.com>
<s6JPYs$GGHA...@TK2MSFTNGXA02.phx.gbl>


>Subject: RE: Difference in generated wrappers for OCXs in vs2003 and vs2005

>Date: Wed, 18 Jan 2006 12:43:26 -0800
>Lines: 214
>Message-ID: <98B53258-1634-4E7D...@microsoft.com>


>MIME-Version: 1.0
>Content-Type: text/plain;
> charset="Utf-8"
>Content-Transfer-Encoding: 7bit
>X-Newsreader: Microsoft CDO for Windows 2000
>Content-Class: urn:content-classes:message
>Importance: normal
>Priority: normal
>X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
>Newsgroups: microsoft.public.vc.mfcole
>NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
>Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGXA03.phx.gbl

>Xref: TK2MSFTNGXA02.phx.gbl microsoft.public.vc.mfcole:31644
>X-Tomcat-NG: microsoft.public.vc.mfcole

0 new messages