Announcement

Collapse
No announcement yet.

MSXML4.INC error with PB9?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • MSXML4.INC error with PB9?

    I have a private program I wrote in PB8 that I was going to update using PB9. Unfortunately, when I try to compile it I get an error saying this line:

    LOCAL oItems AS Msxml2IXMLDOMNodeList

    is an undefined Type. I copied the MSXML4.INC file from PB8 into the WinAPI folder, but still get the error.

    I tried opening the "PowerBASIC Com Browser" in PB9, double-clicked the "Microsoft XML, V4.0", then clicked the "Save As" button to save it as the MSXML4.INC file. But, I still get the same error.

    It worked fine under PB8, what am I doing wrong in PB9?

    Thanks,

    Anthony
    Anthony Watson, Mountain Software
    www.mountainsoftware.com

  • #2
    I don't think the COM browsers 8x/9x produce compatible files.

    I had a working 8x program which would not come close to compiling under 9x, so I just re-created the COM #INCLUDE file with 9x and changed my object names in the source code.

    Note the 9x COM browser has different options on the screen, too.

    Mao might have said, "The Great Leap Forward is not without sacrifice. "

    MCM
    Michael Mattias
    Tal Systems (retired)
    Port Washington WI USA
    [email protected]
    http://www.talsystems.com

    Comment


    • #3
      Michael,

      Thanks for the response. Unfortunately, I adapted the code from a sample somewhere and don't really know what it does. Here's the function in question. The "Msxml" items are giving PB9 fits, even though they compiled under PB8.

      Code:
      FUNCTION get_tax_rate(addr1 AS STRING, city AS STRING, zip AS STRING, rate AS STRING,zip4 AS STRING) AS LONG
        LOCAL oItems    AS Msxml2IXMLDOMNodeList
        LOCAL oItem     AS Msxml2IXMLDOMElement
        LOCAL vItems    AS VARIANT
        LOCAL vItem     AS VARIANT
        LOCAL v1 AS VARIANT
        LOCAL v2 AS VARIANT
        LOCAL v3 AS VARIANT
        LOCAL v4 AS VARIANT
        LOCAL v5 AS VARIANT
        LOCAL url AS STRING
      
        url$="http://dor.wa.gov/AddressRates.aspx?output=xml&addr="+addr1$+"&city="+city$+"&zip="+zip$
      
        SET objXMLHTTP = NEW DISPATCH IN "Msxml2.xmlhttp"
        IF ISNOTHING(objXMLHTTP) THEN
          MSGBOX "Error Creating objXMLHTTP"
          FUNCTION = 1
          EXIT FUNCTION
        END IF
      
        SET objXMLDoc = NEW DISPATCH IN "Msxml2.DOMDocument"
        IF ISNOTHING(objXMLDoc) THEN
          MSGBOX "Error Creating objXMLDoc"
          FUNCTION = 1
          EXIT FUNCTION
        END IF
      
        v1="GET"
        v2=URL$
        v3=0
        v4=""
        v5=""
      
        'STDOUT "Connecting..." & $CRLF
        OBJECT CALL objXMLHTTP.open(v1, v2, v3, v4, v5)
        IF OBJRESULT OR ERR THEN
          MSGBOX "Connection Error"
          SET objXMLHTTP = NOTHING
          FUNCTION = 3
          EXIT FUNCTION
        END IF
      
        'STDOUT "Retrieving Result..." & $CRLF
        v1=""
        OBJECT CALL objXMLHTTP.send(v1)
        IF OBJRESULT OR ERR THEN
          MSGBOX "Send Error"
          SET objXMLHTTP = NOTHING
          FUNCTION = 4
          EXIT FUNCTION
        END IF
      
        OBJECT GET objXMLHTTP.status TO v1
        'STDOUT "Status:" & STR$(VARIANT#(v1)) & $CRLF
      
        OBJECT GET objXMLHTTP.ResponseText TO v1
        IF VARIANTVT(v1) = %VT_EMPTY THEN
          MSGBOX "Retrieve Error"
          FUNCTION = 5
          EXIT FUNCTION
        END IF
      
        a$=UCASE$(VARIANT$(v1))
      
        b=INSTR(a$," RATE=")
        c=INSTR(b+7,a$,CHR$(34))
      
        rate$=""
        IF b<>0 AND c>b THEN
          rate$=MID$(a$,b+7,c-b-7)
        END IF
      
        b=INSTR(a$,"PLUS4=")
        c=INSTR(b+7,a$,CHR$(34))
        zip4$=""
        IF b<>0 AND c>b THEN
          zip4$=MID$(a$,b+7,c-b-7)
        END IF
      
        SET objXMLHTTP = NOTHING
        SET objXMLDoc = NOTHING
      
        FUNCTION = 0
      END FUNCTION
      I "think" I recreated the COM include file as detailed in my first post. How would I determine the new object names?

      Thanks,

      Anthony
      Anthony Watson, Mountain Software
      www.mountainsoftware.com

      Comment


      • #4
        For that code, using the PBWIN 9 COM Browser, click Menu->Tools->Options and, in the Options dialog check the "Always use an Interface Prefix" radio button, type Msxml2 in the "Interface Prefix" edit field, and check the "Generate Dispatch Interfaces Only" check box. Later, double click the type library in the listview to generate the code.
        Forum: http://www.jose.it-berater.org/smfforum/index.php

        Comment


        • #5
          Jose,

          Awesome, Thank you! That's quite a process, but it seems to have worked.

          Anthony
          Anthony Watson, Mountain Software
          www.mountainsoftware.com

          Comment


          • #6
            >That's quite a process, but it seems to have worked.

            I was unable to guess that. That's why I just did it over from scratch.
            Michael Mattias
            Tal Systems (retired)
            Port Washington WI USA
            [email protected]
            http://www.talsystems.com

            Comment


            • #7
              The new browser generates by default interface definitions for direct interface calls, whereas the old browser only generates interface definitions for dispatch interfaces (now called IDBIND), that are quite different.
              Forum: http://www.jose.it-berater.org/smfforum/index.php

              Comment

              Working...
              X