Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

COM in Borland?

Status
Not open for further replies.

XxReaperxX

Programmer
Jul 15, 2001
8
US
I have a COM object that was written in VC++. I've got all the interface inforamtion and Interface ID's for it.

I have a Borland MFC C++ program as well.

My goal is to get this COM object to work with my Borland C++ program, is this possible? Can you interface a COM object with Borland?

Vinh
 
what is the code you create the instance? John Fill
1c.bmp


ivfmd@mail.md
 
i've got the DLL and i know the UID's for the instances .. i need tutorial/sample code to see hwo to use it in my program
 
you should use CoCreateInstance with CLSID of object you're looking for. You get an interface pointer and work with it or query other interfaces. Pay attention on return codes.

CoInitialize(NULL);
IDispatch* pDisp;
IUnknown* pUnk;
CLSID clsid;
CLSIDFromProgID(cApp,&clsid);
CoCreateInstance(clsid,NULL,CLSCTX_SERVER,IID_IUnknown,(void FAR*FAR*)&pUnk);
pUnk->QueryInterface(IID_IDispatch,(void**)&pDisp);
..work here
pDisp->Release();
pUnk->Release();
CoUninitialize(); John Fill
1c.bmp


ivfmd@mail.md
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top