Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Using COM events

Posted on 1998-10-20
3
Medium Priority
?
149 Views
Last Modified: 2010-04-06
I am using a third party COM component.  It has two interfaces declared.  The first allows control of the component, which is working, and the second has three event methods.

The question is, how do you attach a procedure in the Delphi object to the COM event method?
0
Comment
Question by:bcrotaz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 12

Accepted Solution

by:
rwilson032697 earned 600 total points
ID: 1343536
When you import the type library Delphi should create methods that correspond to these events. You then put the code to handle the events in those methods.

Cheers,

Raymond.
0
 
LVL 1

Author Comment

by:bcrotaz
ID: 1343537
If I do this, and at some point in the future I re-import the type library, won't I lose the code in these methods?
0
 
LVL 12

Expert Comment

by:rwilson032697
ID: 1343538
You might do. But then thats what copy and paste was invented for! :-)

If the events are declared the same way as events in VCL control eg Property OnClick: TNotifyEvent...  you should be able to just assign an appropriate method from one of your own classes to that event

eg: below is an excerpt from a class created when I imported a type library...

    function Get_EventHandler: IExchangeEvents; safecall;
    procedure Set_EventHandler(const Value: IExchangeEvents); safecall;
    property EventHandler: IExchangeEvents read Get_EventHandler write Set_EventHandler;

  You should be able to assign a method to EventHandler...

Cheers,

Raymond.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question