• Advertisement
Sign in to follow this  

char/short/int/long/void* and WPARAM/LPARAM/HANDLE on win64

This topic is 1384 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

This is basic but really idont know

 

I assume on win32 

char is 8bit, short is 16 int is 32 long is 32 too, 

HANDLE (HWND, HDC) is same as void* (32 bit)

LPARAM/WPARAM i really donk know - ?

(some other win32 typew worth knowing the size?)

 

Is thislike that? How it looks on win64? (I mean x64  winapi)

Share this post


Link to post
Share on other sites
Advertisement

You can write a tiny program that uses sizeof() to tell you how big any of those things are.

I got no x64 windows (x64 proc but x32 win xp)

Share this post


Link to post
Share on other sites
HWND a;
HDC b;
WPARAM c;
LPARAM d;
static_assert(sizeof(a) == 8, "Bad");
static_assert(sizeof(b) == 8, "Bad");
static_assert(sizeof(c) == 8, "Bad");
static_assert(sizeof(d) == 8, "Bad");

short, etc have the same size on all Windows platforms.

There are types like ULONG_PTR, that are different on various platforms.

Handles have different sizes too.

Maybe you would have a possibility to test your app on X64 platform.

It would have bugs, because of the difference.

Edited by kubera

Share this post


Link to post
Share on other sites

MSDN - Window Data Types

 

These are how Microsoft defines types in the Windows headers.  They are well defined in the scope of Windows.  Most of the types wont change in size, but ones that are intended to store pointers can change in size based on the target platform.

 

Note that target platform is not the same as target processor.  You can run a 32-bit application in a 64-bit environment.  Since it was compiled for a 32-bit target, values like LPARAM will be 32-bits.  If it is targeted for a 64-bit platform, types like LPARAM will expand to a 64-bit value.  Look at the link I provided above, it should tell you which ones do this.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement