"Driver, Greg 9434" wrote:
> l_9fjn.asp .  Using these examples (especially the first) I've been able to
> get it work in VB but not in MapBasic.  In MapBasic I just get the first
> printer name returned in my string but not the other two that should appear!
> Aaargh!

If you get desperate enough to need to read blocks of string data
separated by nulls (like these) from an API in MapBasic, you can
try passing an array of small integers to the function instead of
a string type. In MapBasic strings get terminated by a null, and
so you only see the first one, but with an array of small
integers these nulls are just zeroes and they don't cut the data
short like they do with strings. 

Change the API declaration to accept an array instead of a
string, make sure the array is dimensioned large enough, and call
the API function. On return, the values in the high and low bytes
of each array element are really the ANSI codes for the
characters in what would have been a string. So you just read
them out if the array (in low byte- high byte order) and convert
to characters with Chr$(), skipping over the zeroes and you'll
get your strings.

Yes, it's more work but it's an interesting little hack.

- Bill Thoen

---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 10362

Reply via email to