How to fix "Cannot add event handler because code element marked as read-only" in VS2005 and VS2008

Today VS2008 SP1 pop up an error dialog when I was editing MFC dialog box in VS2008 SP1. The error was saying something like “Cannot add event handler because code element CMainDlg marked as read-only”. Clearly neither .cpp nor .h file for this class was not marked as read-only. Actually none of files in directory were marked…


Aero Wizards (Windows Vista style wizards) in MFC8 (VS2005)

Almost a year ago I was looking on new Vista features to estimate amount of changes to an existing MFC application required to add support for this features. One of these features is new Aero-style wizards that replace Wizard97 on Windows Vista. I have built a small demo that I have used for building a…


Applocal deployment of MFC localized resource DLLs

It was pointed out to me that it is not clear from Docs how to redistribute MFC localized DLLs with MFC application in application local folder. Again while doc team is updating docs, I have put together a quick sample.   If you have MFC application MyApplication.exe and you are going to redistribute VC++ libraries…


Complete example for MFC/Winforms integration

Just posted on MSDN a sample of MFC/Windows Forms integration  as it is in Visual Studio 2005. Please be advised that some parts of it may not work with early builds of VS2005. However it should all work on release of VS2005. Here is the link


cannot access private member error when porting MFC project

On the forum, we have surfaced another error. I had a chance today to see a real-world code with this error and actually to narrow down the problem. So if you see an error like 1>c:\program files\microsoft visual studio 8\vc\atlmfc\include\afxwin.h(259) : error C2248: ‘CObject::operator =’ : cannot access private member declared in class ‘CObject’ 1>…


Windows Forms and MFC Integration using CWinFormDialog

  One of the primary scenarios around integration of Windows Forms into an existing MFC application is around showing a Windows Form as a dialog, similar to CDialog class in MFC. Developer can create a MFC representation of an existing Windows Form control (System::Windows::Form::Control) created in either in C++ or C#. Then he can use…


Linking to MFC and CRT dynamically and statically in one image

If you link your MFC application that consumes MFC static lib, often you may encounter a situation when your app dynamically links to MFC and your library statically links to MFC. When you build this application and you are going to get similar to ones listed below: 1>msvcrtd.lib(ti_inst.obj) : error LNK2005: “private: __thiscall type_info::type_info(class type_info…