BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Not getting Event from COM object written in C#

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OLE Automation
View previous topic :: View next topic  
Author Message
Michael Moreno
Guest





PostPosted: Fri Aug 12, 2005 10:49 am    Post subject: Not getting Event from COM object written in C# Reply with quote



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





PostPosted: Fri Aug 12, 2005 1:48 pm    Post subject: Re: Not getting Event from COM object written in C# Reply with quote



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





PostPosted: Sat Aug 13, 2005 12:31 am    Post subject: Re: Not getting Event from COM object written in C# Reply with quote



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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OLE Automation All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.