Solved

Using COM events

Posted on 1998-10-20
3
144 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 200 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

Suggested Solutions

Title # Comments Views Activity
Delphi application Soap connection 5 133
Strange behavior when a form is closed 6 69
Why can't I create any project with my delphi EXE file? 6 45
update joined tables 2 63
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

726 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