Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Windows data type sizes

Status
Not open for further replies.

Bobby2004

Programmer
Mar 10, 2004
82
IN
I'd like to find out ( programatically ) the sizes of the Windows data types for an application I'm writing but can't find anything in the SDK about it ( the Win32 Simple Data Types topic states these sizes but I need to find them out dynamically ).

One thing I'm not clear about in this connection is whether the Windows SDK data type names are *efficiet* i.e. will an INT be the word size of the hardware the app is running on or will it always be some fixed size, especially accross versions e.g. 32 bits under current versions and 64 bits under future versions?
 
Since this is a VB6 forum I guess that you're using VB6.

C and C++ have a builtin operator called sizeof that will return the number of bytes occupied by any given piece of data which is why there is no explicit mention of it in the SDK.

The LenB function will do a similar job in VB6.

As far as VB6 is concerned the size of all datatypes is fixed irrespective of the hardware on which it is running.

Thus an integer is always 2 bytes and a long is always 4 bytes.

This also holds true for VB.NET although there an integer is 4 bytes and a long is 8 bytes. This is a fixed part of the language.


Bob Boffin
 
Yes, I'm working with VB6. Youre right about sizeof and LenB but I need to deal with the Windows data types in portable way, merely conceptual though they might be.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top