On Mon, 14 Aug 2006 12:10:21 -0400, J. Merrill <[EMAIL PROTECTED]> wrote:

>What is your code to fire the event(s)?

Event COM interface defined as

[ComVisible(true)]
[Guid("C9F4436D-0795-4604-8A80-CA36CC9611FE")]
[InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
public interface ISimpleSource
{
 [DispId(1)]
 void SimpleEvent(string msg);
}

My class is defined as

[ComSourceInterfaces(typeof(ISimpleSource),typeof(IMweSource))]
[ClassInterface(ClassInterfaceType.None)]
[ComVisible(true)]
[Guid("7454BE8B-287E-4032-9657-B2B5C36A6BB5")]
public partial class MweCtrl : UserControl, IMweCtrl1
{
    ...

    [ComVisible(false)]
    public delegate void SimpleTarget(string msg);

    public event SimpleTarget SimpleEvent;

    private void button1_Click(object sender, EventArgs e)
    {
 if (SimpleEvent != null)
     SimpleEvent("Event msg!");
    }

    ...
}

By debugging I've come to the conclusion that the ActiveX Control Test
Container successfully registers with the SimpleEvent where as VB6 seems
not to. When running from VB6 SimpleEvent is null, i.e. no one is listening
in that case. So I guess the real question is how to make VB6 register for
the event.

Kind regards,
Magnus Werner

>
>At 09:09 AM 8/14/2006, Magnus Werner wrote
>>I've been implementing an ActiveX control using C#. The control has a
>>source interface marked using the ComSourceInterfaces attribute like this
>>
>>[ComSourceInterfaces(typeof(ISimpleSource),typeof(IMweSource))]
>>
>>Now, when I test this control in the ActiveX Control Test Container it
>>works fine. I can call the methods and I receive the events from the
>>control. But when I try to use the same control in VB6 (I drop it on to a
>>form) a stub is generated in VB6 for the event. However, this stub is
never
>>called. It seems like VB6 ignores the event or does not receive it.
>>
>>Does anyone have an explanation for this behaviour?
>>
>>Kind regards,
>>Magnus Werner
>
>
>J. Merrill / Analytical Software Corp
>
>===================================
>This list is hosted by DevelopMentorĀ®  http://www.develop.com
>
>View archives and manage your subscription(s) at http://discuss.develop.com
===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to