#14 On message event not called.

v1.0_(example)
closed-later
core (14)
5
2003-08-20
2002-08-30
Anonymous
No

In vb.net and c# the onmessage event is not called.
The
messages are removed from the queue but the method is never
called.

Discussion

  • tom lambrechts
    tom lambrechts
    2002-09-02

    Logged In: YES
    user_id=604512

    While registering for the event in c# an error is raised:

    An
    unhandled exception of type 'System.InvalidCastException' occurred
    in interop.activejms.dll

    Additional information: No such
    interface supported

    'DefaultDomain': Loaded
    'c:\winnt\microsoft.net\framework\v1.0.3705\mscorlib.dll', No
    symbols loaded.
    'WindowsApplication4': Loaded 'C:\Documents
    and Settings\TLA\My Documents\Visual Studio
    Projects\WindowsApplication4\bin\Debug\WindowsApplication4.exe',
    Symbols loaded.
    'WindowsApplication4.exe': Loaded
    'c:\winnt\assembly\gac\system.windows.forms\1.0.3300.0__b77a5c561934e089\system.windows.forms.dll',
    No symbols loaded.
    'WindowsApplication4.exe': Loaded
    'c:\winnt\assembly\gac\system\1.0.3300.0__b77a5c561934e089\system.dll',
    No symbols loaded.
    'WindowsApplication4.exe': Loaded
    'c:\winnt\assembly\gac\system.drawing\1.0.3300.0__b03f5f7f11d50a3a\system.drawing.dll',
    No symbols loaded.
    'WindowsApplication4.exe': Loaded
    'c:\winnt\assembly\gac\accessibility\1.0.3300.0__b03f5f7f11d50a3a\accessibility.dll',
    No symbols loaded.
    'WindowsApplication4.exe': Loaded
    'c:\documents and settings\tla\my documents\visual studio
    projects\windowsapplication4\bin\debug\interop.activejms.dll', No
    symbols loaded.
    An unhandled exception of type
    'System.InvalidCastException' occurred in
    interop.activejms.dll

    Additional information: No such interface
    supported

    Unhandled Exception:
    System.InvalidCastException: No such interface supported
    at
    System.Runtime.InteropServices.UCOMIConnectionPoint.Advise(Object
    pUnkSink, Int32& pdwCookie)
    at
    ActiveJMS.ActiveJMSSource_EventProvider.add_onMessage(ActiveJMSSource_onMessageEventHandler
    )
    at
    ActiveJMS.ActiveJMSClass.add_onMessage(ActiveJMSSource_onMessageEventHandler
    )
    at WindowsApplication4.Form1.Form1_Load(Object sender,
    EventArgs e) in c:\documents and settings\tla\my documents\visual
    studio projects\windowsapplication4\form1.cs:line 151
    at
    System.Windows.Forms.Form.OnLoad(EventArgs e)
    at
    System.Windows.Forms.Form.OnCreateControl()
    at
    System.Windows.Forms.Control.CreateControl(Boolean
    fIgnoreVisible)
    at
    System.Windows.Forms.Control.CreateControl()
    at
    System.Windows.Forms.Control.WmShowWindow(Message&
    m)
    at System.Windows.Forms.Control.WndProc(Message&
    m)
    at
    System.Windows.Forms.ScrollableControl.WndProc(Message&
    m)
    at
    System.Windows.Forms.ContainerControl.WndProc(Message&
    m)
    at
    System.Windows.Forms.Form.WmShowWindow(Message&
    m)
    at System.Windows.Forms.Form.WndProc(Message&
    m)
    at
    System.Windows.Forms.ControlNativeWindow.OnMessage(Message&
    m)
    at
    System.Windows.Forms.ControlNativeWindow.WndProc(Message&
    m)
    at
    System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr
    hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
    at
    System.Windows.Forms.SafeNativeMethods.ShowWindow(IntPtr
    hWnd, Int32 nCmdShow)
    at
    System.Windows.Forms.Control.SetVisibleCore(Boolean
    value)
    at
    System.Windows.Forms.Form.SetVisibleCore(Boolean value)

    at System.Windows.Forms.Control.set_Visible(Boolean value)

    at
    System.Windows.Forms.ThreadContext.RunMessageLoop(Int32
    reason, ApplicationContext context)
    at
    System.Windows.Forms.Application.Run(Form mainForm)
    at
    WindowsApplication4.Form1.Main() in c:\documents and
    settings\tla\my documents\visual studio
    projects\windowsapplication4\form1.cs:line 105
    The program
    '[1804] WindowsApplication4.exe' has exited with code 0 (0x0).

     
    • labels: --> core
    • assigned_to: nobody --> nphelps
     
  • Logged In: YES
    user_id=130188

    I'd love to tell you I can fix it, but unfortunatly, I haven't been
    able to get any ActiveX Bean events to work in .NET.
    Frankly, I don't know what the problem is. I'd love if anyone
    could identify the problem and possible solution. It works
    from Visual Basic 6.0, Visual C++, Python, etc. but for some
    reason the InvalidCastException gets thrown when you try
    and run it from .NET. Sorry...

     
  • tom lambrechts
    tom lambrechts
    2002-09-13

    Logged In: YES
    user_id=604512

    There is a solution.
    The problem is in the interop proxy that is
    created.
    It is a common bug in the axtive x bridge of sun.

    A
    solution is to wrap the active jms into a new axtivex vb 6.0 component. In
    this component you capture the events and rethrow them.
    You only
    have to wrap the events the other method calls you can do directly on the
    active jms component.
    Just add the following code in a activex vb 6
    project build is and you can use it in c#

    Option
    Explicit

    Private WithEvents mWisClient As
    ActiveWisClient.ActiveWisClient
    Public Event
    onMessage(ByVal OnMessageEvent1 As Object)
    Public Event
    onTraceMessage(ByVal OnTraceMessageEvent1 As
    Object)

    Private Sub mWisClient_onMessage(ByVal
    OnMessageEvent1 As Object)
    MsgBox "ikke"
    RaiseEvent
    onMessage(OnMessageEvent1)
    End Sub

    Private Sub
    mWisClient_onTraceMessage(ByVal OnTraceMessageEvent1 As
    Object)
    RaiseEvent
    onTraceMessage(OnTraceMessageEvent1)
    End
    Sub

    Public Function getActiveWisClient() As
    ActiveWisClient.ActiveWisClient
    If mWisClient Is Nothing
    Then
    Set mWisClient = New ActiveWisClient.ActiveWisClient

    End If
    Set getActiveWisClient = mWisClient
    End
    Function

    Public Sub setActiveWisClient(ByVal pWisClient As
    ActiveWisClient.ActiveWisClient)
    Set mWisClient =
    pWisClient
    End Sub

     
  • tom lambrechts
    tom lambrechts
    2002-09-13

    Logged In: YES
    user_id=604512

    Ooops this is not the code for the active jms :-)
    but the way of working is
    the same.
    Just replace active wis client by active jms...

     
    • status: open --> closed-later