Re: memory functions - Got it


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Re: memory functions - Got it

  1. #1
    peter higgins Guest

    Re: memory functions - Got it


    This code does the trick for fillmemory

    Public Sub dotest()
    Dim hdrk As HeaderRecord 'udt
    Dim plen&
    plen = Len(hdrk)
    FillStructure hdrk.Section, plen
    End Sub
    Public Sub FillStructure(ByRef struc() As Byte, ByVal plen&)
    Dim Blankstr$
    Blankstr$ = Space(plen)
    CopyMemory struc(0), ByVal Blankstr, plen&
    Debug.Print
    End Sub

    if anybody sees potential problems, please let me know.

    "peter higgins" <plh@topform.com> wrote:
    >
    >I have a VBA 97 app that uses structures consisting of binary arrays to

    write
    >binary data out to files. I would like to speed it up by initializing the
    >arrays with blanks using fillmemory, and copy strings to them using copy
    >memory.
    >
    >I declared the pointers as long, and tried passing the firstbyte of the

    first
    >structure variable. I also tried declaring strings as byval.
    >VBA is giving me unmatched declaration errors, and I am contemplating if
    >putting it in a dll would make any difference, besides adding to my troubles.
    >
    >
    >I have read so many help articles on this I am confused as to what is a

    BSTR
    >or pointer or string, or...
    >Plus I cannot find any documentation that gives the VB or C data types for
    >Fillmemory pointers, which I assume are long or any.
    >
    >Questions:
    >Will longs work for the memory pointer variables
    >Does FillMemory use longs for memory pointers
    >Will VBA 97 reference an structure variable's pointer?
    >Will VBA 97 strings passed byval pass the pointer?
    >
    >
    >private type StrucTest
    > one_ar as byte(9)
    > two_ar as byte(3)
    >end
    >This version doesn't work.
    >...declare copymemory ... dest&, srce&,length&
    >copymemory structest.one_ar(0) ,Byval astring ...
    >
    >any pointers (no pun intended) on how to use pointers and structures will
    >be appreciated.



  2. #2
    peter higgins Guest

    Re: memory functions - Got it


    This code does the trick for fillmemory

    Public Sub dotest()
    Dim hdrk As HeaderRecord 'udt
    Dim plen&
    plen = Len(hdrk)
    FillStructure hdrk.Section, plen
    End Sub
    Public Sub FillStructure(ByRef struc() As Byte, ByVal plen&)
    Dim Blankstr$
    Blankstr$ = Space(plen)
    CopyMemory struc(0), ByVal Blankstr, plen&
    Debug.Print
    End Sub

    if anybody sees potential problems, please let me know.

    "peter higgins" <plh@topform.com> wrote:
    >
    >I have a VBA 97 app that uses structures consisting of binary arrays to

    write
    >binary data out to files. I would like to speed it up by initializing the
    >arrays with blanks using fillmemory, and copy strings to them using copy
    >memory.
    >
    >I declared the pointers as long, and tried passing the firstbyte of the

    first
    >structure variable. I also tried declaring strings as byval.
    >VBA is giving me unmatched declaration errors, and I am contemplating if
    >putting it in a dll would make any difference, besides adding to my troubles.
    >
    >
    >I have read so many help articles on this I am confused as to what is a

    BSTR
    >or pointer or string, or...
    >Plus I cannot find any documentation that gives the VB or C data types for
    >Fillmemory pointers, which I assume are long or any.
    >
    >Questions:
    >Will longs work for the memory pointer variables
    >Does FillMemory use longs for memory pointers
    >Will VBA 97 reference an structure variable's pointer?
    >Will VBA 97 strings passed byval pass the pointer?
    >
    >
    >private type StrucTest
    > one_ar as byte(9)
    > two_ar as byte(3)
    >end
    >This version doesn't work.
    >...declare copymemory ... dest&, srce&,length&
    >copymemory structest.one_ar(0) ,Byval astring ...
    >
    >any pointers (no pun intended) on how to use pointers and structures will
    >be appreciated.



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center