Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » Link with .NET component
Link with .NET component [message #49517] Tue, 27 May 2003 09:20 Go to next message
Eclipse UserFriend
Originally posted by: ebriere.codagen.com

Hi all,
I built a testing component using .NET (C#). I try to invoke it from SWT.
Everthing works fine except for event handling. It seems that my assembly
recognize that a listener is connected to it but I get an exception from the
..NET side when it tries to return back the control to my plug-in (I think).

Someone else has experienced the same problem?

Thanks!
Re: Link with .NET component [message #50571 is a reply to message #49517] Tue, 27 May 2003 16:16 Go to previous message
Eclipse UserFriend
Originally posted by: ebriere.codagen.com

Finally got the twist. Hope this partial code helps someone...

Partial Plug-In Code in Java

webControlSite = new OleControlSite(frame, SWT.NONE,
"MyNetControl.UserControl1");
OleAutomation automation = new OleAutomation(webControlSite );
webControlSite.doVerb(OLE.OLEIVERB_UIACTIVATE );

int dispIdMember2 = 101;
webControlSite.addEventListener ( dispIdMember2, new OleListener() {
public void handleEvent(OleEvent event) {
// Do something here....
return;
}
);


Partial C# code...

using System.Runtime.InteropServices;

namespace MyNetControl
{
public delegate void ClickEventHandler();

[Guid("47C976E0-C208-4740-AC42-41212D3C34F0"),
InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
public interface Events
{
[DispId(101)]
void ClickEvent();
}

[Guid("9E5E5FB2-219D-4ee7-AB27-E4DBED8E123E"),
ClassInterface(ClassInterfaceType.None),
ComSourceInterfaces(typeof(Events))]

public class UserControl1 : System.Windows.Forms.UserControl
{

event ClickEventHandler ClickEvent;

private void button1_Click(object sender, System.EventArgs e)
{
if (ClickEvent != null)
{
ClickEvent();
}
else
{
MessageBox.Show("oups!");
}
}

}
}

"Eric" <ebriere@codagen.com> wrote in message
news:bavoma$t9n$1@rogue.oti.com...
> Hi all,
> I built a testing component using .NET (C#). I try to invoke it from SWT.
> Everthing works fine except for event handling. It seems that my assembly
> recognize that a listener is connected to it but I get an exception from
the
> .NET side when it tries to return back the control to my plug-in (I
think).
>
> Someone else has experienced the same problem?
>
> Thanks!
>
>
Previous Topic:Linux non root user
Next Topic:setTitleToolTip - no effect
Goto Forum:
  


Current Time: Sat May 10 00:50:54 EDT 2025

Powered by FUDForum. Page generated in 0.03320 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top