What do LRESULT, WPARAM and LPARAM mean?

前端 未结 4 1497
暖寄归人
暖寄归人 2020-12-25 14:07

I\'m importing WinApi functions, writing callbacks etc. (example) in C# and always wonder:

  • what do they mean ? LRESULT as last result ? W
4条回答
  •  死守一世寂寞
    2020-12-25 14:54

    That's an example for hungarian notation:

    • L in both LPARAM and LRESULT means "long", designating a 32-bit int
    • w in WPARAM means "word" (which used to be 16-bit int but is now also a 32 bit int — at least when targeting a 32-bit architecture)

    The remainder of the type names / aliases is supposed to hint at their meaning, i.e. LRESULT containing some kind of result value, LPARAM and WPARAM being used for parameter variables.

    The actual meaning of the wParam and lParam parameters' content depends on the particular message being sent; they are just generic buckets for message parameters. So it's quite likely that you won't be able to circumvent unsafe type casts.

提交回复
热议问题