AxWebBrowser problems in VS2005

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Dave Booker

    #1

    AxWebBrowser problems in VS2005

    It appears that I cannot correctly install the AxWebBrowser in VS2005.

    I can instantiate an "AxWebBrows er browser" and refer to its members,
    properties, and methods. I'm having trouble with the AxWebBrowser.Do cument:
    When I print browser.Documen t.GetType().ToS tring() at runtime, I get
    "mshtml.HTMLDoc umentClass". But The VS2005 compiler does not recognize the
    member AxWebBrowser.Do cument as anything other than a System.Object -- e.g.,
    "Define doc As mshtml.HTMLDocu mentClass = browser.Documen t" will fail to
    compile with "Type 'mshtml.HTMLDoc umentClass' is not defined."

    When I try to install the missing component(s) via "aximp" and "tlbimp",
    there seems to be no effect whatsoever. The commands I run in the project
    directory, in a VS.NET Command Prompt, are:

    aximp c:\windows\syst em32\shdocvw.dl l
    tlbimp mshtml.tlb

    The only suspicious behavior that goes on during the installation itself is
    a short list of warnings generated by tlbimp. They are as follows:

    TlbImp : warning TI0000 : At least one of the arguments for
    'IActiveIMMApp. GetDe faultIMEWnd' cannot be marshaled by the runtime
    marshaler. Such arguments will therefore be passed as a pointer and may
    require unsafe code to manipulate.
    TlbImp : warning TI0000 : The type library importer could not convert the
    signat ure for the member '__MIDL___MIDL_ itf_mshtml_0256 _0010.hbmpCheck ed'.
    TlbImp : warning TI0000 : The type library importer could not convert the
    signat ure for the member '__MIDL___MIDL_ itf_mshtml_0256 _0010.hbmpUnche cked'.
    TlbImp : warning TI0000 : The type library importer could not convert the
    signat ure for the member '__MIDL___MIDL_ itf_mshtml_0256 _0010.hbmpItem' .
    TlbImp : warning TI0000 : The type library importer could not convert the
    signat ure for the member '_userBITMAP.pB uffer'.
    TlbImp : warning TI0000 : The type library importer could not convert the
    signat ure for the member '__MIDL___MIDL_ itf_mshtml_0256 _0011.hbmpCheck ed'.
    TlbImp : warning TI0000 : The type library importer could not convert the
    signat ure for the member '__MIDL___MIDL_ itf_mshtml_0256 _0011.hbmpUnche cked'.
    TlbImp : warning TI0000 : The type library importer could not convert the
    signat ure for the member '__MIDL___MIDL_ itf_mshtml_0256 _0011.hbmpItem' .
    TlbImp : warning TI0000 : The type library importer could not convert the
    signat ure for the member '_FLAGGED_BYTE_ BLOB.abData'.
    Type library imported to MSHTML.dll

    Whether or not these warnings are significant enough to prevent proper
    installation, I do not know. In any event, the control doesn't seem to be
    getting installed correctly at all. Any advice on doing this correctly or
    determing the point of failure of this component's installation in the dev
    environment?

    --------

    Bonus points: I am afraid I'm missing the bigger picture with typecasting in
    VB .NET 2.0. Even though the compiler thinks AxWebBrowser.Do cument is a
    simple Object, it still lets me reference members within it that only exist
    in mshtml.HTMLDocu mentClass. That is, it doesn't complain that System.Object
    has no such member as "documentelemen t". In fact, I've even tried nonsense
    strings like "foobar" -- anything goes! The compiler will allow me to
    pretend that AxWebBrowser.Do cument has any imaginary members I want it to
    have, and then waits until runtime to see if I'm right. If the member does
    exist, then great, the runtime environment hands it to me as a plain
    System.Object. (From there, I can even continue printing out
    GetType().ToStr ing(). In this manner I've learned of the existence of a
    whole slew of classes I should have but don't have, such as
    mshtml.HTMLHtml ElementClass.) Otherwise -- that is, if the member doesn't
    exist ("foobar" or what have you) -- it hangs forever trying to search for
    it. My questions are:
    1) Why is the compiler so relaxed about missing datatypes, coercing them
    upwards into Objects instead of complaining that they're missing?
    2) Why does the compiler get so lenient about nonexistent members whenever
    this happens?
    3) Why does VB .NET hang whenever it can't find something, rather than
    gracefully reporting the problem (e.g., by throwing an exception)?
  • Cor Ligthert [MVP]

    #2
    Re: AxWebBrowser problems in VS2005

    Dave,

    Are you using the AxWebBrowser of the Net 2.0 Webbrowser.

    Cor

    "Dave Booker" <dbooksta@newsg roup.nospam> schreef in bericht
    news:1F96800F-5F4A-4749-BADD-B7CB0C7EFA4E@mi crosoft.com...[color=blue]
    > It appears that I cannot correctly install the AxWebBrowser in VS2005.
    >
    > I can instantiate an "AxWebBrows er browser" and refer to its members,
    > properties, and methods. I'm having trouble with the
    > AxWebBrowser.Do cument:
    > When I print browser.Documen t.GetType().ToS tring() at runtime, I get
    > "mshtml.HTMLDoc umentClass". But The VS2005 compiler does not recognize
    > the
    > member AxWebBrowser.Do cument as anything other than a System.Object --
    > e.g.,
    > "Define doc As mshtml.HTMLDocu mentClass = browser.Documen t" will fail to
    > compile with "Type 'mshtml.HTMLDoc umentClass' is not defined."
    >
    > When I try to install the missing component(s) via "aximp" and "tlbimp",
    > there seems to be no effect whatsoever. The commands I run in the project
    > directory, in a VS.NET Command Prompt, are:
    >
    > aximp c:\windows\syst em32\shdocvw.dl l
    > tlbimp mshtml.tlb
    >
    > The only suspicious behavior that goes on during the installation itself
    > is
    > a short list of warnings generated by tlbimp. They are as follows:
    >
    > TlbImp : warning TI0000 : At least one of the arguments for
    > 'IActiveIMMApp. GetDe faultIMEWnd' cannot be marshaled by the runtime
    > marshaler. Such arguments will therefore be passed as a pointer and may
    > require unsafe code to manipulate.
    > TlbImp : warning TI0000 : The type library importer could not convert the
    > signat ure for the member
    > '__MIDL___MIDL_ itf_mshtml_0256 _0010.hbmpCheck ed'.
    > TlbImp : warning TI0000 : The type library importer could not convert the
    > signat ure for the member
    > '__MIDL___MIDL_ itf_mshtml_0256 _0010.hbmpUnche cked'.
    > TlbImp : warning TI0000 : The type library importer could not convert the
    > signat ure for the member '__MIDL___MIDL_ itf_mshtml_0256 _0010.hbmpItem' .
    > TlbImp : warning TI0000 : The type library importer could not convert the
    > signat ure for the member '_userBITMAP.pB uffer'.
    > TlbImp : warning TI0000 : The type library importer could not convert the
    > signat ure for the member
    > '__MIDL___MIDL_ itf_mshtml_0256 _0011.hbmpCheck ed'.
    > TlbImp : warning TI0000 : The type library importer could not convert the
    > signat ure for the member
    > '__MIDL___MIDL_ itf_mshtml_0256 _0011.hbmpUnche cked'.
    > TlbImp : warning TI0000 : The type library importer could not convert the
    > signat ure for the member '__MIDL___MIDL_ itf_mshtml_0256 _0011.hbmpItem' .
    > TlbImp : warning TI0000 : The type library importer could not convert the
    > signat ure for the member '_FLAGGED_BYTE_ BLOB.abData'.
    > Type library imported to MSHTML.dll
    >
    > Whether or not these warnings are significant enough to prevent proper
    > installation, I do not know. In any event, the control doesn't seem to be
    > getting installed correctly at all. Any advice on doing this correctly or
    > determing the point of failure of this component's installation in the dev
    > environment?
    >
    > --------
    >
    > Bonus points: I am afraid I'm missing the bigger picture with typecasting
    > in
    > VB .NET 2.0. Even though the compiler thinks AxWebBrowser.Do cument is a
    > simple Object, it still lets me reference members within it that only
    > exist
    > in mshtml.HTMLDocu mentClass. That is, it doesn't complain that
    > System.Object
    > has no such member as "documentelemen t". In fact, I've even tried
    > nonsense
    > strings like "foobar" -- anything goes! The compiler will allow me to
    > pretend that AxWebBrowser.Do cument has any imaginary members I want it to
    > have, and then waits until runtime to see if I'm right. If the member
    > does
    > exist, then great, the runtime environment hands it to me as a plain
    > System.Object. (From there, I can even continue printing out
    > GetType().ToStr ing(). In this manner I've learned of the existence of a
    > whole slew of classes I should have but don't have, such as
    > mshtml.HTMLHtml ElementClass.) Otherwise -- that is, if the member doesn't
    > exist ("foobar" or what have you) -- it hangs forever trying to search for
    > it. My questions are:
    > 1) Why is the compiler so relaxed about missing datatypes, coercing them
    > upwards into Objects instead of complaining that they're missing?
    > 2) Why does the compiler get so lenient about nonexistent members whenever
    > this happens?
    > 3) Why does VB .NET hang whenever it can't find something, rather than
    > gracefully reporting the problem (e.g., by throwing an exception)?[/color]


    Comment

    • Dave Booker

      #3
      Re: AxWebBrowser problems in VS2005

      I'm trying to use the AxWebBrowser. As far as I can tell the .NET 2.0
      WebBrowser doesn't expose all of the functionality I need.

      "Cor Ligthert [MVP]" wrote:
      [color=blue]
      > Dave,
      >
      > Are you using the AxWebBrowser of the Net 2.0 Webbrowser.
      >
      > Cor[/color]

      Comment

      • Cor Ligthert [MVP]

        #4
        Re: AxWebBrowser problems in VS2005

        Dave,

        I and probably me not alone (and seeing people strugling with that) did
        never succeed in direct instancing the AxWebbrowser. Did you already drag an
        webbrowser on a form from the toolbox?

        Cor

        "Dave Booker" <dbooksta@newsg roup.nospam> schreef in bericht
        news:B5301C51-EBDC-41AB-8797-B0B26C45A6DC@mi crosoft.com...[color=blue]
        > I'm trying to use the AxWebBrowser. As far as I can tell the .NET 2.0
        > WebBrowser doesn't expose all of the functionality I need.
        >
        > "Cor Ligthert [MVP]" wrote:
        >[color=green]
        >> Dave,
        >>
        >> Are you using the AxWebBrowser of the Net 2.0 Webbrowser.
        >>
        >> Cor[/color]
        >[/color]


        Comment

        • Linda Liu [MSFT]

          #5
          RE: AxWebBrowser problems in VS2005

          Hi Dave,

          Thank you for posting.

          The Documnent property of the AxWebBrowser is Object typed and read-only.
          There's a Navigate() method in the AxWebBrowser class which could be used
          to display a url resource such as a html page, a jpg file, a word document
          and so on. Then at run-time, we could use the Document property of the
          AxWebBrowser to get an object representing the resource currently displayed
          in the AxWebBrowser control. The type of the Document varies with the type
          of the resource which the AxWebBrowser is browsing. For example, if the
          resource is a html page, the type of the Document will be
          "mshtml.HTMLDoc umentClass". And if the resource is a word document, the
          type of the Document will be "Microsoft.Offi ce.Interop.Word .DocumentClass" .
          That is to say, the compiler could not determine which type the Document is
          at design-time.

          Because the resource is accessed and displayed at run-time, the compiler
          could not check out any error when compiling even if the resource doesn't
          exist. When running, a default web page saying "The page cannot be
          displayed" will appear in the AxWebBrowser control if the resource doesn't
          exist and it doesn't take a long time to display this default web page. I
          have performed a test and confirmed this.

          Hope this is helpful to you.
          If you have any concerns or need anything else, please don't hesitate to
          let me know.


          Sincerely,
          Linda Liu
          Microsoft Online Community Support

          =============== =============== =============== =======
          When responding to posts,please "Reply to Group" via
          your newsreader so that others may learn and benefit
          from your issue.
          =============== =============== =============== =======

          Comment

          • Herfried K. Wagner [MVP]

            #6
            Re: AxWebBrowser problems in VS2005

            "Dave Booker" <dbooksta@newsg roup.nospam> schrieb:[color=blue]
            > I'm trying to use the AxWebBrowser. As far as I can tell the .NET 2.0
            > WebBrowser doesn't expose all of the functionality I need.[/color]

            Which functionality do you need? Note that
            'WebBrowser1.Do cument.DomDocum ent' provides access to the unmanaged document
            object.

            --
            M S Herfried K. Wagner
            M V P <URL:http://dotnet.mvps.org/>
            V B <URL:http://classicvb.org/petition/>

            Comment

            • Linda Liu [MSFT]

              #7
              RE: AxWebBrowser problems in VS2005

              Hi Dave,

              You have mentioned that "Define doc As mshtml.HTMLDocu mentClass =
              browser.Documen t" will fail to compile with "Type
              'mshtml.HTMLDoc umentClass' is not defined."

              The type HTMLDocumentCla ss is located in Microsoft.mshtm l assembly and the
              namespace is mshtml. To use the type HTMLDocumentCla ss in your code, you
              should add a reference to Microsoft.mshtm l into your project.

              Hope this is helpful to you.
              If you have any other concerns or need anything else, please don't hesitate
              to let me know.


              Sincerely,
              Linda Liu
              Microsoft Online Community Support

              =============== =============== =============== =======
              When responding to posts,please "Reply to Group" via
              your newsreader so that others may learn and benefit
              from your issue.
              =============== =============== =============== =======

              Comment

              Working...