Hi!
I'm pretty new to .NET and I am trying to have a VBScript consume an event created in a .NET component.
I started out with http://msdn.microsoft.com/en-us/library/dd8bf0x3.aspx.
I registered the assembly for COM interop and made it COM visible (checkboxes in the Visual Studio 2--8 project properties dialog).
This is the .NET Code:
using System.Runtime.InteropServices;
namespace PureEvents
{
public delegate void ClickDelegate(int x, int y);
public delegate void ResizeDelegate();
// Step 1: Defines an event sink interface (ButtonEvents) to be
// implemented by the COM sink.
[GuidAttribute("1A585C4D-3371-48dc-AF8A-AFFECC1B0967")]
[InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch)]
public interface ButtonEvents
{
void Click(int x, int y);
void Resize();
}
// Step 2: Connects the event sink interface to a class
// by passing the namespace and event sink interface
// ("EventSource.ButtonEvents, EventSrc").
[ComSourceInterfaces(typeof(ButtonEvents))]
public class PureEvents
{
public event ClickDelegate Click;
public event ResizeDelegate Resize;
public string getValue()
{
return "Normal method call";
}
public PureEvents()
{
}
public void CauseClickEvent(int x, int y)
{
Click(x, y);
}
public void CauseResizeEvent()
{
Resize();
}
}
}
The VBScript code looks like this:
sub X_Resize
msgBox "Here"
end sub
set BFI=wscript.createobject("PureEvents.PureEvents","X_")
msgBox BFI.GetValue()
BFI.CauseResizeEvent
msgBox "There"
The getValue()-Method gets called properly, so the component itself works.
However, when I call CauseResizeEvent, I get an 80004001 error (method or process not implemented".
Am I missing anything obvious here?
The script does not run in IIS or internet explorer, it just gets double clicked and then runs in wscript.exe.
I appreciate any help.
Lots of Greetings!
Volker
--
For email replies, please substitute the obvious.



