David Torrey
David Torrey

Reputation: 1352

C++ wParam and Lparam confusion

I know that wParam and lParam are (32 bit I belive) bits of information specific to the message being passed at the time, but is there any way to tell what each message puts into the two?

I read somewhere that wParam is 16 bit and lParam is 32 bit, but it still doesn't really explain what I should expect to see, or at least which variable I should expect to see something in. I've seen some examples of messages using lParam, and other examples of messages using wParam, and yet other examples of both being used.

For instance, I saw keydown uses wParam for receiving a specific key, but lParam is used in LButtondown, with the upper 16 being the y, and the lower 16 being the x. The reason that one specifically should be in lParam makes sense (because it takes 32 bits), but how can I find out which one other messages send, and what is in them?

(sorry, I think I may have repeated my question a couple times in that slight rant)

Upvotes: -1

Views: 3735

Answers (3)

Florian
Florian

Reputation: 5994

just take a look at the documentation of microsoft: as example WM_KEYDOWN: http://msdn.microsoft.com/en-us/library/windows/desktop/ms646280(v=vs.85).aspx

Upvotes: 1

ApprenticeHacker
ApprenticeHacker

Reputation: 22031

I'm sorry. But the reliable way to know what is being passed in the wParam and lParam of each message is to refer to the documentation.

I read somewhere that wParam is 16 bit and lParam is 32 bit

According to this, WPARAM is an unsigned (32-bit) int, while LPARAM is a signed long.

Upvotes: 5

Jon
Jon

Reputation: 437554

You have to look at the MSDN reference for each message you are interested in and individually read what significance wParam and lParam have for it. A full reference can be found here.

Upvotes: 3

Related Questions