how to properly sink event or use AxHost.ConnectionPointCookie?

  • Thread starter Thread starter GS
  • Start date Start date
G

GS

I got trouble from trying to sink event to a class itself.. I want the
inherited webbrowser to handle newwindow2 event and raise it to consuming
control

the crux of the problem is the statement ( for lack of understanding
getCtype and
AxHost.ConnectionPointCookie ):
cookie = New AxHost.ConnectionPointCookie(Me.ActiveXInstance, _
wevents, GetType(DWebBrowserEvents2)) <== error


Here are the high level details
the class is

....
public class extendedWebBrowser
inherits system.windows.forms.webbrowser

Private cookie As AxHost.ConnectionPointCookie
Private wevents As WebBrowserExtendedEvents
.......

Protected Overrides Sub CreateSink()
MyBase.CreateSink()
wevents = New WebBrowserExtendedEvents(Me)
cookie = New AxHost.ConnectionPointCookie(Me.ActiveXInstance, _
wevents, GetType(DWebBrowserEvents2)) ' <<< oops error about
' not exposing IConnectionPointContainer
End Sub


.....
end class
<ComImport(), _
Guid("34A715A0-6587-11D0-924A-0020AFC7AC4D"), _
InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch), _
TypeLibType(TypeLibTypeFlags.FHidden)> _
Public Interface DWebBrowserEvents2
.......

End Interface


thank you for your time and expertise
 
Back
Top