LPARAM WPARAM

Started by
6 comments, last by LessBread 18 years, 4 months ago
what is size of the two type?the MSDN give no anwser.
Advertisement
On Win32 both types are 32-bits. On Win64, I believe both types are 64-bits.
Well... from the headerfiles:
typedef UINT_PTR WPARAM;
typedef LONG_PTR LPARAM;

and:

#if defined(_WIN64)
typedef __int64 INT_PTR, *PINT_PTR;
typedef unsigned __int64 UINT_PTR, *PUINT_PTR;

typedef __int64 LONG_PTR, *PLONG_PTR;
typedef unsigned __int64 ULONG_PTR, *PULONG_PTR;

#define __int3264 __int64

#else
typedef _W64 int INT_PTR, *PINT_PTR;
typedef _W64 unsigned int UINT_PTR, *PUINT_PTR;

typedef _W64 long LONG_PTR, *PLONG_PTR;
typedef _W64 unsigned long ULONG_PTR, *PULONG_PTR;

#define __int3264 __int32

#endif

there you go: an unsigned int and a long.

Cheers
Here is a excerpt from petzold :-

The origin of these names requires a bit of history. When Windows was a 16-bit system, the third parameter to WndProc was defined as a WORD, which was a 16-bit unsigned short integer, and the fourth parameter was defined as a LONG, which was a 32-bit signed long integer. That's the reason for the "W" and "L" prefixes on the word "PARAM." In the 32-bit versions of Windows, however, WPARAM is defined as a UINT and LPARAM is defined as a LONG (which is still the C long data type), so both parameters to the window procedure are 32-bit values. This may be a little confusing because the WORD data type is still defined as a 16-bit unsigned short integer in Windows 98, so the "W" prefix to "PARAM" creates somewhat of a misnomer.
"I think there is a world market for maybe five computers." -- Thomas Watson, Chairman of IBM, 1943
Quote:Original post by Nokturnal
Here is a excerpt from petzold :-
so both parameters to the window procedure are 32-bit values. This may be a little confusing because the WORD data type is still defined as a 16-bit unsigned short integer in Windows 98, so the "W" prefix to "PARAM" creates somewhat of a misnomer.


in winnt win2000, is not WORD 16 bit?

Quote:Original post by ernow
Well... from the headerfiles:
typedef UINT_PTR WPARAM;
typedef LONG_PTR LPARAM;


Cheers


where is HWND ??

typedef /* [wire_marshal] */ void *HWND; //WTypes.h

What is this?

Quote:Original post by Nokturnal
Here is a excerpt from petzold :-

The origin of these names requires a bit of history. When Windows was a 16-bit system, the third parameter to WndProc was defined as a WORD, which was a 16-..........


Petzold said a wrong thing.
When the WndProc window procedure receives a WM_VSCROLL message, the high word of the lParam parameter is the handle to the child window.

I found the LOWORD is right or whole lparam

Yes a WORD is 16 bit on Windows 2000. Petzold wrote his book in 1998, but what it says about the Win32 API is still valid for the most part. However, if you have questions about a specific function, it's probably worth checking MSDN.
"I thought what I'd do was, I'd pretend I was one of those deaf-mutes." - the Laughing Man
Quote:Original post by luasitdown
where is HWND ??

typedef /* [wire_marshal] */ void *HWND; //WTypes.h

What is this?


What is what?

A HWND is a void pointer.

typedef void *HWND;

I don't recall which header file it's defined in. windef.h maybe.

/* [wire_marshal] */

This comment imparts information relevant for COM ("common object model" not old school .com files) applications. Don't worry about it.

"I thought what I'd do was, I'd pretend I was one of those deaf-mutes." - the Laughing Man

This topic is closed to new replies.

Advertisement