Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS General Discussion » Casting CFrameWnd to CExtNCW in a C++ project with managed extensions (that is /clr switch specified Collapse All
Subject Author Date
Cyndi Chatman Jan 31, 2007 - 2:40 PM

Have you had any reports of problems of implementing CFrameWnd as CExtNCW < CFrameWnd > in a managed project? I have two versions of my project: one compiled without the /clr switch and one compiled with the /clr switch. I do this as I can #ifdef my mananged code and can debug much faster in the project compiled without the /clr switch. I have been developing in this project for a while and just compiled the /clr version of the project getting ready for a release. With the /clr project, my message handlers for my SDI CMainFrame will not work. For example, I click File>Open and nothing happens. Even clicking the "X" in the right-hand corner has no affect. The same is true if I click the New/Open/Save in the toolbar. I cannot trace where the messages are going. All works fine in the non /clr project. I removed the CExtNCW cast from the CMainFrame class and all started working (I just have the old looking mainframe again).

For a quick test, I modified the Static MBCS Release version of the Page Navigator project. I set the Use Managed Extensions to Yes on the General tab. I also had to add struct definition for _TREEITEM in stdafx.h for this run correctly. AND.... the PageNavigator sample is now behaving like my /clr project - that is, the messages are not being handled? Is this a known problem with a work around?

Cyndi Chatman Feb 1, 2007 - 7:54 AM

I have emailed a zipped copy of Page Navigator sample that is showing the problem. I use VS 2003 (710 solution) and MBCS Static build.

Technical Support Feb 2, 2007 - 4:35 AM

We replied by email.

Technical Support Feb 1, 2007 - 5:29 AM

Prof-UIS can be used in the mixed managed/native projects even if the UI thread’s message loop is controlled by .NET framework. We turned on /clr option in the PageNavigator sample application, compiled it with several LNK4248 linker warnings related to the _TREEITEM type name and run this sample application successfully. We do not see any problems in it. All the menu/toolbar commands were invoked correctly. The mixed managed/native project should not use the _ underline character as the first character in type names to avoid linker warnings and run-time problems. Such linker warnings should be ignored if they are related to types declared in Win32 SDK.