Re: Array of byte of unknown size
From: Mike Manning (NOMORESPAM_at_nowhere.com.au)
Date: 11/17/03
- Next message: Anchorman: "Seek() won't compile???"
- Previous message: Mike Manning: "Re: Array of byte of unknown size"
- In reply to: Peter Below (TeamB): "Re: Array of byte of unknown size"
- Next in thread: Constantine Yannakopoulos: "Re: Array of byte of unknown size"
- Reply: Constantine Yannakopoulos: "Re: Array of byte of unknown size"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 18 Nov 2003 08:04:39 +1100
Hi Peter
The example given in the control's help file is for Visual Basic - so
they've used the VB dynamic array:
ie ..
Dim data() As Byte
data = Control1.SaveToMemory
I may have missed something (and wasted a lot of my time) but after hunting
through the Delphi help file and Google I couldn't see any way of doing the
same thing with a variant array in Delphi
Mike
"Peter Below (TeamB)" <100113.1101@compuXXserve.com> wrote in message
news:VA.0000a6be.005823e3@nomail.please...
> In article <3fb8c96e$1@newsgroups.borland.com>, Mike Manning wrote:
> > In my Delphi 5 app I'm using a variant array to receive binary data from
a
> > third party activeX control, for subsequent storing in a database.
> >
> > Unfortunately its not possible to know in advance the size of the data
in
> > the control - it could be 100 byte or 10 Mbyte or more.
> >
> > What I'm wondering is - if I set the bounds of the array to a high
number -
> > eg 100 MByte -
> > buf := VarArrayCreate([0, 100000000], varbyte)
> > so that I can be reasonably sure it will always be larger than the sixe
of
> > the control's data, what implications does that have for memory
resources ?
>
> Dire ones. I see out of memory errors in your future.
>
> > ie does VarArrayCreate try to allocate that amount of memory ?
>
> Of course.
>
> >
> > (Unfortunately I can't get the control's data in "chunks" - it has to
come
> > all at once by calling the control's "save to memory" method.)
>
> ActiveX controls that return data in variant arrays usually work this way:
> you pass them an *empty* variant by reference and they allocate the
required
> memory for its content, which you then use and free (automatically when
the
> variant goes out of scope).
>
> --
> Peter Below (TeamB)
> Use the newsgroup archives :
> http://www.mers.com/searchsite.html
> http://www.tamaracka.com/search.htm
> http://groups.google.com
> http://www.prolix.be
>
>
- Next message: Anchorman: "Seek() won't compile???"
- Previous message: Mike Manning: "Re: Array of byte of unknown size"
- In reply to: Peter Below (TeamB): "Re: Array of byte of unknown size"
- Next in thread: Constantine Yannakopoulos: "Re: Array of byte of unknown size"
- Reply: Constantine Yannakopoulos: "Re: Array of byte of unknown size"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|