I'm trying to create a MFC Automation COM object using MFC Library DLL but I am having issues. I have created the DLL and the TLB file has been generated. When I want to import the TLB file into a MFC Application, Visual Studios tells me
Cannot open source file C:/Users/XXX/documents/visual studio 2015/projects/ComDlgInDll/TestApp/ComDlgInDll.tlh
This is the command I type:
#import "..\Debug\ComDlgInDll.tlb" no_namespace
And even if I just type
#import
It will just go right ahead to the path and say that it cannot find the TLH file.
I don't have a TLH file at all, so I am confused as to why I cannot import it.
I would appreciate a solution since I am new to MFC and COM.
I also wanted to mention when I create a C# Windows Forms application, I add the DLL as a COM reference and then I type:
ComDlgInDll.ComDialogFactory var = new ComDlgInDll.ComDialogFactory();
var.GetDialog();
I get this error:
Retrieving the COM class factory for component with CLSID {1B2F7173-E140-47F3-8921-860BD434B05E} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).
I even went into the registry to search for that uuid and I couldn't find it, which is odd. I am not sure why that uuid that is associated with a coclass is not being registered.
I would appreciate any help on it as I have been dealing with this for quite some time.
User contributions licensed under CC BY-SA 3.0