Results 1 to 4 of 4

Thread: Unsigned 16-bit? - Resolved

  1. #1

    Thread Starter
    Addicted Member Max_aka_NOBODY's Avatar
    Join Date
    Jul 2004
    Location
    Amman, Jordan
    Posts
    179

    Resolved Unsigned 16-bit? - Resolved

    Is there an unsigned 16-bit data type(word) in VB6? If no, is there a way to fake it?
    Last edited by Max_aka_NOBODY; Jan 28th, 2005 at 06:13 AM.

  2. #2
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Unsigned 16-bit?

    Both Boolean and Integer are two bytes (16 bits)

  3. #3
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682

    Re: Unsigned 16-bit?

    Quote Originally Posted by Max_aka_NOBODY
    Is there an unsigned 16-bit data type(word) in VB6? If no, is there a way to fake it?
    Is this for an API call or something?

    You could try using this. I haven't coded in VB6 for a while so I may be wrong.

    VB Code:
    1. Public Type UInt16
    2.     Hi as Byte '8bits
    3.     Lo as Byte '8bits
    4. End Type

    To extract the held value just use

    VB Code:
    1. dim x as UInt16
    2.  
    3. x = '//some data//
    4.  
    5. [B]MyNumber = (x.Hi*256) or x.Lo[/B]
    Last edited by wossname; Jan 28th, 2005 at 04:12 AM.
    I don't live here any more.

  4. #4

    Thread Starter
    Addicted Member Max_aka_NOBODY's Avatar
    Join Date
    Jul 2004
    Location
    Amman, Jordan
    Posts
    179

    Re: Unsigned 16-bit?

    No, I need to read a binary value from a file that is a word. Although I'm not planning any math operations on it, a simple integer would work, butI prefer to keep the values in correct formats, and I might just have to display it once or twice. As for the approach, thanx a lot for it, it's so simple. How could I not think of that myself?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width