Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > General > Word types


Reply
 
Thread Tools Display Modes
  #1  
Old 03-14-2007, 04:15 PM
dcbasic dcbasic is offline
Junior Contributor
 
Join Date: Jun 2003
Posts: 261
Default Word types


Does VB6 have any functions that can get the word type bytes in a file?
Reply With Quote
  #2  
Old 03-14-2007, 04:45 PM
passel's Avatar
passel passel is offline
Sinecure Expert

Super Moderator
* Guru *
 
Join Date: Jun 2003
Location: Upstate New York, usa
Posts: 7,714
Default

Perhaps I'm behind the times...
What is meant by the phrase "word type bytes"?
__________________
There Is An Island Of Opportunity In The Middle of Every Difficulty.
Miss That, Though, And You're Pretty Much Doomed.
Reply With Quote
  #3  
Old 03-14-2007, 05:07 PM
dcbasic dcbasic is offline
Junior Contributor
 
Join Date: Jun 2003
Posts: 261
Default

I wasn't exactly sure either. I'm attempting a port of some Delphi code to VB6 and well, from what it looks like, a word type is two bytes, flipped (assumed to have something to do with endians - no idea though) i.e. hex BD31 is 31BD and is converted to an integer. So Str(&H31BD) would return the integer I'm looking for.
Reply With Quote
  #4  
Old 03-14-2007, 09:55 PM
RoofRabbit's Avatar
RoofRabbit RoofRabbit is offline
Contributor
 
Join Date: Sep 2003
Location: Lenoir, NC - USA
Posts: 731
Default

The order is Intel based with the lower byte being first. On another computer like the 68000 based cpu, it is the other way around. The term "Word" (from assembly language) is the same as an Integer in VB. Be aware an integer in vb is considered to be either a plus or minus number by using the MSB (far left bit in binary) as a sign value rather than part of the number represented. When this is a problem (numbers greater than 32767), I normally convert the 2 byte "word" value to a Long which is 4 bytes. It wastes 2 bytes of memory but retains the origional Word value.
__________________
Website http://roofrabbit.com/
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->