Results 1 to 5 of 5

Thread: calling dll

  1. #1

    Thread Starter
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083

    calling dll

    guys ,Could anyone hlep me to get out of this hell ?
    I am calling a dll method which is "Navigate" and "Navigate2" from my class "Navigation" but it keeps firing this error which damn says :

    an unhandled exception of type "InvalidActiveXStateException" occurred in axinterop.shdocvw.dll

    when I call this method from the form it's fine.
    Don't you think this have to do with inheritence :
    I tried this :
    VB Code:
    1. Imports AxSHDocVw.AxWebBrowser
    2. Public Class Navigation
    3.     Public Shared MyWeb As New AxSHDocVw.AxWebBrowser()
    4.  
    5.     Public Shared Function Back() As String
    6.         MyWeb.GoBack()
    7.     End Function
    8.  
    9.     Public Shared Function Forward() As String
    10.         MyWeb.GoForward()
    11.     End Function
    12.  
    13.     Public Shared Function Go() As String
    14.  
    15.     End Function
    16.  
    17.     Public Shared Function Refresh() As String
    18.         MyWeb.Refresh()
    19.     End Function
    20.  
    21.     Public Shared Function Stopp() As String
    22.         MyWeb.Stop()
    23.     End Function
    24.  
    25.     Public Shared Function Home() As String
    26.         MyWeb.GoHome()
    27.     End Function
    28.  
    29.     Public Shared Function Navigate() As String
    30.         Dim nullObject As System.Object = 0
    31.         Dim URL As Object
    32.         Dim Str As String = ""
    33.         Dim nullObjStr As System.Object = Str
    34.         Cursor.Current = Cursors.WaitCursor  ' Navigate to location found in textbox        
    35.         MyWeb.Navigate2(URL, nullObject, nullObjStr, nullObjStr, nullObjStr)
    36.         Cursor.Current = Cursors.Default
    37.  
    38.         'or you can safely use this :
    39.         'MyWeb.Navigate("www.home.com")
    40.  
    41.     End Function
    42.  
    43. End Class

  2. #2

    Thread Starter
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    the error occurred only in this code:
    VB Code:
    1. Public Shared Function Navigate() As String
    2.         Dim nullObject As System.Object = 0
    3.         Dim URL As Object
    4.         Dim Str As String = ""
    5.         Dim nullObjStr As System.Object = Str
    6.         Cursor.Current = Cursors.WaitCursor  ' Navigate to location found in textbox        
    7. 'here ++++++++++++++++++++++++++++++++++++++
    8.         MyWeb.Navigate2(URL, nullObject, nullObjStr, nullObjStr,
    9. nullObjStr)
    10. '++++++++++++++++++++++++++++++++++++++++++
    11.         Cursor.Current = Cursors.Default
    12.  
    13.         'or you can safely use this :
    14. 'here ++++++++++++++++++++++++++++++
    15.         'MyWeb.Navigate("www.home.com")
    16.  
    17.     End Function

  3. #3
    Frenzied Member trisuglow's Avatar
    Join Date
    Jan 2002
    Location
    Horsham, Sussex, UK
    Posts
    1,536
    Don't really know a lot about this, but here are some thoughts:

    MSDN has this to say:

    "The public properties and methods of an ActiveX control can only be referenced after the ActiveX control has been instantiated and initialized completely; otherwise the AxHost.InvalidActiveXStateException exception is thrown. The AxHost.InvalidActiveXStateException exception class contains the name of the member that made the reference and the member type. The member type is one of the AxHost.ActiveXInvokeKind enumerated values."




    Is Navigate2() a function? Does it return an error/success value? Can you look at that to get some extra information?

    Can you look at the members of AxHost.InvalidActiveXStateException and find out exactly what exception is being thrown? Maybe you can put a Try - Catch around the call to Navigate2 and ignore the error and see what result that gives you (just for debug - i'm not recommending you release your code like that!)
    This world is not my home. I'm just passing through.

  4. #4

    Thread Starter
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    you're great man
    First , it doesn't return value.
    Second , when I set the try _ catch structure a msg thrown says :
    "exception of type invalidActiveXStateException was thrown"

    I did created the instance but dunno how to initialize it .It needs that constructor to be supplied with parameters .
    thanx a lot trisuglow for your time.

  5. #5

    Thread Starter
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    If I got one more push , I'll appreciate that.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width