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!

Does Borland Support COM ?

Status
Not open for further replies.

XxReaperxX

Programmer
Jul 15, 2001
8
US
Is there a way I can get a COM object to work under Borland?
 
What version? All versions upper than 3.2 supports different versions of COM. John Fill
1c.bmp


ivfmd@mail.md
 
got any sample code showing how to use a COM object in borland? not how to make one, but how to use one with a 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
 
what's the header file for CoInitialize and stuff? its not in ole2.h
 
In ole2.h are all includes you need. So just #include<ole2.h>. What version of C++ are you using? John Fill
1c.bmp


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

Part and Inventory Search

Sponsor

Back
Top