Announcement

Collapse
No announcement yet.

Extracting contents of a "safe array"

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

    Extracting contents of a "safe array"

    Line the "inc" created with "Dispatch Interfaces only":

    Code:
        Property Get FontFamilyNames <35> () As Variant
    My code:

    Code:
    GLOBAL vtemp AS VARIANT
    ...
    ...
    OBJECT GET mySession.FontFamilyNames TO vtemp
    No error is returned by this line and on examining vtemp the contents are described as "safe array".

    How do I extract the contents - at some point I must use "UBOUND" as there is no count. As far as I know vtemp contains an array of strings.

    Bob

    ---------------------------------------------
    Added Later - Found the answer but don't know why it works - Thought that you had to use VARIANT$ to convert a Variant string to a "normal" string.

    Code:
    LOCAL varray() AS STRING
    DIM varray(0 TO 20) AS STRING
    
    vtemp = EMPTY
    OBJECT GET mySession.FontFamilyNames TO vtemp
    
    varray() = vtemp
    
    MSGBOX STR$(UBOUND(varray))
    MSGBOX varray(3)
    Last edited by Robert Wallace; 4 Aug 2009, 07:30 AM.

    #2
    There are a series of "safe array" functions/demos in the VBAPI32.INC file in the WinApi folder of your compiler installation.

    There are also some VB samples of using VB arrays (safe arrays) in the samples/VB folder, also installed with the compiler.
    Michael Mattias
    Tal Systems (retired)
    Port Washington WI USA
    [email protected]
    http://www.talsystems.com

    Comment


      #3
      MCM - thanks for the pointers.

      The amount of documentation for this kind of work is overwhelming - the Application Interface documentation alone runs to 418 pages - before I even start with PBWin

      Bob

      Comment


        #4
        >the Application Interface documentation alone runs to 418 pages

        Peanuts.

        Get into healthcare EDI. The documentation for a claim is 700+ pages. BTW, there's three of those... one each for facility (hospitals, nursing homes, hospices, etc), professional (doctors) and dental (um, dentists).

        2100+ pages in all. The three IGs are all "close but not close enough that only one will do." Cost me about $200.00 just to get 'em printed two-sided, three-hole punched from the PDF files.

        Then there's your remittance advice, your eligiiblity inquiry/response, your benefit enrollment, your claim status inquiry/response......
        Michael Mattias
        Tal Systems (retired)
        Port Washington WI USA
        [email protected]
        http://www.talsystems.com

        Comment


          #5
          PB offers the conversion from/to safearrays.
          Not very known but it does.

          Dump an array to a variant will convert it.
          hellobasic

          Comment

          Working...
          X
          😀
          🥰
          🤢
          😎
          😡
          👍
          👎