| View previous topic :: View next topic |
| Author |
Message |
Michael Moreno Guest
|
Posted: Fri Aug 12, 2005 10:49 am Post subject: Not getting Event from COM object written in C# |
|
|
Hello,
I have written a COM dll in C#.
The DLL contains a COM object which fires events.
From a VB application I can get the event. In Delphi I do not receive
them. The log file from the C# DLL shows that the event is fired.
This is part of the TLB.pas file generated when imported the DLL ( I
have removed the GUID and methods declaration to make it slimmer).
ISD_COMQueueEvents = dispinterface
procedure onRecordSetReceived(const aRSet: Recordset15); dispid
1610743808;
end;
ISD_COMQueue = interface(IDispatch)
procedure Connect; safecall;
end;
CoSD_COMQueue = class
class function Create: ISD_COMQueue;
...
end;
TSD_COMQueueonRecordSetReceived = procedure(Sender: TObject; const
aRSet: Recordset15) of object;
TSD_COMQueue = class(TOleServer)
private
FOnonRecordSetReceived: TSD_COMQueueonRecordSetReceived;
FIntf: ISD_COMQueue;
protected
procedure InvokeEvent(DispID: TDispID; var Params: TVariantArray);
override;
public
procedure Connect; override;
published
property OnonRecordSetReceived: TSD_COMQueueonRecordSetReceived
read FOnonRecordSetReceived write FOnonRecordSetReceived;
end;
This is the way I use the objects in my code:
*** Private variables declared in the Form
SD_COMQueue1: TSD_COMQueue; // the Component that will receive and
manage the event
FQueue : ISD_COMQueue; // The object
*** Creation and Connection
FQueue := CoSD_COMQueue.Create();
FQueue.Connect;
SD_COMQueue1.ConnectTo(FQueue); // I always do it this way because
the Delphi TLibImp is buggered as we all know
*** Event management
procedure TFrmXXX.SD_COMQueue1onRecordSetReceived(
Sender: TObject; const aRSet: Recordset15);
begin
ShowMessage('yes'); // =====> Never
shown
end;
Can you see anything wrong or can you suggest something to try please?
Thank you.
--
Michael
----
http://michael.moreno.free.fr/
http://port.cogolin.free.fr/
|
|
| Back to top |
|
 |
Michael Moreno Guest
|
Posted: Fri Aug 12, 2005 1:48 pm Post subject: Re: Not getting Event from COM object written in C# |
|
|
I have found the issue.
It is again this £&"%*(!!*%^ TLibImp doing an appalling job! The event
was not fired because the tlibimp could not find the dispid of the
event which was actually declared in the interface it had declared just
a few lines before + the Recordset was declared as a variant instead of
a recordset.
I cannot say enough how sick and tired I am of this TLibImp exe !!!
--
Michael
----
http://michael.moreno.free.fr/
http://port.cogolin.free.fr/
|
|
| Back to top |
|
 |
Oliver Townshend Guest
|
Posted: Sat Aug 13, 2005 12:31 am Post subject: Re: Not getting Event from COM object written in C# |
|
|
| Quote: | I cannot say enough how sick and tired I am of this TLibImp exe !!!
|
You should post this error on QC along with the steps to reproduce so that
Borland can fix the error.
The best Library Importer I've encountered is with Delphi 5.
Oliver Townshend
|
|
| Back to top |
|
 |
|