Solved

Bind dll functions to runtime object events.

Posted on 2000-03-23
5
244 Views
Last Modified: 2010-04-04
I'm creating a runtime object into a
library (dll).
This object has an "xxx" type event :
i want to assign this event to a function contained into the library.
How can I define this new function to be binded to the "xxx" event?
I don't have classes into this library (dll).
0
Comment
Question by:Geppo
  • 3
5 Comments
 

Expert Comment

by:Carpathia
ID: 2651346
You can get the address of each function within your DLL by using GetProcAddress, (and LoadLibrary if needed).

Once you have this address, you can typecast it to the type of event you are wanting to call. You may have to place this into a temporary event variable before assigning this event to the event property.

Hope this helps :)

0
 

Author Comment

by:Geppo
ID: 2659915
I can't use GetProcAddress because the function itself is defined into my library.
I can get the address of my function with the @operator, but i can't typecast it to my type event (a procedure of object).

Thanks for your help.
0
 

Author Comment

by:Geppo
ID: 2659917
I can't use GetProcAddress because the function itself is defined into my library.
I can get the address of my function with the @operator, but i can't typecast it to my type event (a procedure of object).

Thanks for your help.
0
 

Author Comment

by:Geppo
ID: 2663104
I can't use the Getprocaddress into my Library: the runtime object is created into the dll.

Also, i can't typecast my function to the type event, it doesn't work.
0
 
LVL 12

Accepted Solution

by:
rwilson032697 earned 100 total points
ID: 2886930
Sorry, you can't do this. The reason is because you can only export functions/propcedures from a DLL, not events. You will need to create a normal event handler in your application which then calls the appropriate procedure in the DLL.

Cheers,

Raymond.
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

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…
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 Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

785 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