Re: Handling COM event from C#?
- From: "Grant Schenck" <schenckg@xxxxxxxxxxxxx>
- Date: Wed, 8 Jun 2005 16:36:04 -0400
Figured it out if anyone is interested:
----------------------------------
void MyEventReady()
{
System.Console.Error.WriteLine("--- EventReady ---");
object objEvent = STCtl.GetNextEvent();
}
public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
STCtl = new CtlClass();
STCtl.Initialize("200");
STCtl.EventReady += new _ICtlEvents_EventReadyEventHandler(MyEventReady);
...
----------------------------------
--
Grant Schenck
"Grant Schenck" <schenckg@xxxxxxxxxxxxx> wrote in message
news:uveWEIFbFHA.3144@xxxxxxxxxxxxxxxxxxxxxxx
> I have a COM object which throws a simple event.
>
> The event signature is:
>
> void EventReady();
>
> I see that Intellisense shows the events.
>
> I assume I need to code up a member function with the same signature,
i.e.:
>
> void MyEventReady()
> {
> }
>
> This shows code from my simple test program. I'm using my COM object and
> can create it and then call it's initialize method. However, I can't
figure
> out the syntax to wire in my event so that it will be called.
>
> My code is basicly this:
> -------------------------------------------------
> using STCONTROLLib;
> ...
>
> namespace STCtlTest
> {
> /// <summary>
> /// Summary description for Form1.
> /// </summary>
> public class Form1 : System.Windows.Forms.Form
> {
> private System.ComponentModel.Container components = null;
>
> private Ctl STCtl;
>
> public Form1()
> {
> //
> // Required for Windows Form Designer support
> //
> InitializeComponent();
> STCtl = new CtlClass();
> STCtl.Initialize("200");
>
> !!! What do I need to code here to hook up my event?
> -------------------------------------------------
> Thanks,
> --
> Grant Schenck
>
>
>
.
- References:
- Handling COM event from C#?
- From: Grant Schenck
- Handling COM event from C#?
- Prev by Date: Re: .Net security for shared network driver
- Next by Date: Getting at variant containing safe array from COM object?
- Previous by thread: Handling COM event from C#?
- Next by thread: Worker thread vs BeginInvoke?
- Index(es):