Announcement

Collapse
No announcement yet.

Passing Arrays from PbDll to VbApp

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

  • Passing Arrays from PbDll to VbApp

    I am having problems with a GPF with arrays, and I believe it has to do with how VB handles arrays vs how PB handles arrays. So I started looking at "SafeArray" but all the examples I find only involve Passing an array of a numeric type.

    Since I am in a real crunch and the customer (unreasonably) expects the code in a day or 2 (Don't ask...I had no control over the time-frame) I am hoping someone has a simple example of passing arrays (including strings) to and from VB to and from PB.

    I never thought something as simple as passing an array could be a major bane on my life at the moment, and my mind is too busy frying "Bigger Fish" than "Pass an Array"

    Many Thanx to anyone that can show me a simple example :coffee4:
    Engineer's Motto: If it aint broke take it apart and fix it

    "If at 1st you don't succeed... call it version 1.0"

    "Half of Programming is coding"....."The other 90% is DEBUGGING"

    "Document my code????" .... "WHYYY??? do you think they call it CODE? "

  • #2
    There are convert PB arrays to/from safe array functions and examples in the VBAPI.INC file included in samples. Also some demo programs using those functions.

    > never thought something as simple as passing an array could be
    > a major bane on my life

    PowerBASIC's arrays are a PROPRIETARY construct, and they work just terrific within all PowerBASIC-compliled code modules. 'Passing an array' IS simple when you stay within those parameters.

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

    Comment


    • #3
      What kind of array?
      Pointers and MoveMemory() can help as well.
      hellobasic

      Comment


      • #4
        MCM
        PowerBASIC's arrays are a PROPRIETARY construct, and they work just terrific within all PowerBASIC-compliled code modules. 'Passing an array' IS simple when you stay within those parameters.
        Yep, and if I had the time I would use all PB (my choice) and just have them call my function, and I handle it internally

        But since I have to pass the info back to VB, its not an option at the moment.

        Edwin
        What kind of array?
        Pointers and MoveMemory() can help as well.
        To keep things simple, I was looking at Long for number, and string for strings (Lets not get started on the whole ASCIIZ vs String vs Fixed String for the moment)

        the VBAPI32.INC is what I am looking at, and from what I can tell is really manipulating pointers to the strings (or longs) in the array. I wish I had time to investigate, but time is an issue

        Sorry if I sound like "Help Help I can't swim", and I am sure someone will point out I am in 3ft of water and yell "ummm dude, you might want to just stand up"
        Engineer's Motto: If it aint broke take it apart and fix it

        "If at 1st you don't succeed... call it version 1.0"

        "Half of Programming is coding"....."The other 90% is DEBUGGING"

        "Document my code????" .... "WHYYY??? do you think they call it CODE? "

        Comment


        • #5
          I just looked at that #INCLUDE file.

          I thought there would be functions like...

          PBArrayToSafeArray (PbArray(), something)
          and
          SafeArrayToPbArray (pSafeArray, PBArray()

          I need to look at creating some functions like that.

          One of the problems (I think) is going to be allocate/De-allocate... unless we just "make a rule" that you must call 'safearrayDealloc' when done with it, something like that.

          Come to think of it, doesn't...

          LET VariantVar = PBArray()

          create a SafeArray as the contents of variantVar? That would sure simplify this a lot.


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

          Comment

          Working...
          X