 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Sergio Martins Guest
|
Posted: Fri Aug 29, 2003 6:52 pm Post subject: Events in a COM Object |
|
|
Dears
I need to build a structure like this description.
I want build an COMObject and to published one (or more) events
(OnSomething). Inside of object's procedures (AnyMethod) I intend to perfom
a test and call this event (like "if event <> NIL then call event).
In a Client (a .exe Delphi or VB or Java or C++ or C# or ...) I will
instanciate this object, to build a function (MyFunction with a ShowMessage
for example), assign this function (MyFunction) to object event to, when I
to invoke the method (AnyMethod) it will execute and call the function in
the client (the function with the ShowMessage).
How to do this ?
Could someone send me an example or link or ... ?
thanks ...
Ex. Like this
COMObject (Server)
type
TEvent = class(xxx)
private
public
private
protected
{ Protected declarations }
procedure AnyMethod; safecall;
procedure OnSomethig;
end;
....
procedure TEvento.AnyMethod;
begin
for i := 0 to 1000 do
if ((i mod 100) = 0) then
if (Assigned(OnSomethig) <> NIL)
OnSomethig;
end;
----------------------------------------------------------------------------
----------------
EXE Client (Delphi, VB, Java, C++, C#, etc)
....
function MyFunction()
begin
ShowMessage('XXXXXXXXXXXXXXXXXXXXXXXXXX');
end
procedure ClickDeUmbotão()
begin
obj := Instanciate the COMObject;
obj.OnSomethig:= MyFunction; //Assign my function to event on COMObject
obj.AnyMethod();
end;
Sergio Martins Vieira
[email]martins (AT) rm (DOT) com.br[/email]
Brasil
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|