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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do you use COM objects that have not been written in Delphi? 1

Status
Not open for further replies.

Vovin

Programmer
Aug 24, 2003
63
GB
Hi,

can anyone help me with this? I have created a COM object in Visual C++ using the ATL COM AppWizard (that's me alienated most of the Delphi forum now).

If your still reading then this is my problem. There are plenty of examples of Delphi code that use COM objects that have been written in Delphi with their associated type libraries written in .pas files. Does anyone have an example of Delphi code that uses a COM object written in any other language.

The reason I used a C++ COM object is that Delphi cannot do what I want it to do. Please...please don't reply saying 'why don't you write it in Delphi instead'.

If I try and use these pieces of code I get exceptions:
certChecker := CreateComObject(CLSID_CertChecker);
or
certChecker := CreateOleObject('RevokeCert.CertChecker');

Any help would be much appreciated. Thanks in advance.
 
Hi Vovin - out of curiosity, what won't Delphi do?

(Not knocking C++, just very curious!!)

A COM object is a COM object, so will be callable by anything that supports COM.

I spent a few months doing COM last year, but haven't any code handy, but in Delphi, your object should be declared as an interface of your COM obj. Then do a CoCreate.

e.g.

MyComObj : IMyComInterface

MyComObj := CoMyComInterface.Create;

You will have to import the typelibrary first
(Project > import type library).

Or thereabouts.....


 
Thanks Martin,

that did the trick.

"out of curiosity, what won't Delphi do?"

Well I'm really a C++ programer my Delphi skills aren't that great. It's probably possible to do it in Delphi it's just that I don't have the time to mess around with it.

I'm trying to use functions from wincrypt.h. I know that someone had created a Delphi version of this. I tried it and couldn't get it to work so fell back on what I know best.

Thanks again for your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top