
Passing an Excel COM object to a C++ COM Server
use "importlib" in the idl file instead:
// test68.idl : IDL source for test68.dll
//
// This file will be processed by the MIDL tool to
// produce the type library (test68.tlb) and marshalling code.
import "oaidl.idl";
import "ocidl.idl";
[
uuid(A723E7C0-14B4-11D5-ACF1-0060B0FCF40A),
version(1.0),
helpstring("test68 1.0 Type Library")
]
library TEST68Lib
{
importlib("stdole32.tlb");
importlib("stdole2.tlb");
importlib("G:\\Program Files\\Microsoft Office\\Office\\EXCEL8.OLB");
[
object,
uuid(A723E7CC-14B4-11D5-ACF1-0060B0FCF40A),
helpstring("IFooBarObj Interface"),
pointer_default(unique)
]
interface IFooBarObj : IUnknown
{
[helpstring("method BarFoo")] HRESULT BarFoo(IRange* pRng);
};
[
uuid(A723E7CD-14B4-11D5-ACF1-0060B0FCF40A),
helpstring("FooBarObj Class")
]
coclass FooBarObj
{
[default] interface IFooBarObj;
};
Quote:
};
--
Reginald Blue | Opinions expressed here do not
Natural Language Understanding | necessarily represent those of
Unisys Corporation | my employer.
--------------------------------+-------------------------------
NL technology,speech application| My email address is wrong, you
development training, see: | need to remove the obvious.
http://www.speechdepot.com/ +-------------------------------
Hi
I am currently trying to create a COM Server under C++ using ATL. This
COM
server will be accessed by Excel and be given Excel Range Objects. So I need
to
import the Excel type library in my idl file.
To be able to import the Excel interfaces I used the OLE/COM object
viewer to
open the Excel8.olb file and copied what was displayed in a .idl file. This
worked fine until I tried to build my project : the generated idl file was
filled
with errors.
Due to the amount of corrections needed, I wondered if there was another
way
to do this.
Thanks.
Laurent