if included afxwinforms.h; createinstance for component present in dll fails. RRS feed

  • Question

  •  Hi,

    I have one dll containing 3 MFC com component and some 2-3 MFC dailog. I want to load one Managed (C#) control in one of the dialog. I have added managed control in MFC dialog, compiler option for file set to /clr. dll created without any error.

    But when I call CreateInstance for any of the MFC component, it fails saying "0x80040111 ClassFactory cannot supply requested class ". It works fine if i remove managed control from dialog.

    Further, I investigated and found that whether I add managed control or not it does not have any effect. Only when i include in any file and compile using /clr option; CreateInstance falis with above error. if i remove and keep /clr option then it works fine.

    Thursday, December 11, 2008 8:05 AM