Re: MFC App with ATL Interface that does not Import
GRLR-HDD <GRLRHDD@discussions.microsoft.com> wrote:
"Igor Tandetnik" wrote:
Is the type library actually bound to AppA.exe as a resource? Try
#import'ing the TLB file, rather than EXE.
First, "bound to AppA.exe" ... nice statement.
How can I verify that? Is there a simple tool to verify that an EXE
or DLL has the typelib info within it?
File | Open | File, select your EXE, click a little down arrow next to
Open button and choose Open With..., choose Resource Editor and click
Open. A resource view of the executable will appear. There should be a
section named TYPELIB and, under it, a resource with an id of 1. That's
how type libraries are stored inside executables.
I'm not sure VC2005 is the same in VC2003, to set up this resource, you
do the following. Open Resource View (View | Resource View). Right-click
ProjectName.rc node, choose Resource Includes. A dialog opens with three
edit boxes. Make sure edit box at the bottom contains the following
line:
1 TYPELIB ProjectName.tlb
(replace ProjectName with the actual name of your project, of course).
By the way, I tried the AppA.tlb and yes the "#import" line does work.
However, the COM_PTR reference errors out.
What is the error? What is the code the error refers to? I seem to have
misplaced my crystal ball lately.
--
With best wishes,
Igor Tandetnik
With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925