I'm looking for confirmation on this windows programming idiom, am I correct in thinking that many different types of "handles" are passed around as not only LRESULT objects but also lParam and wParam objects?
I'm guessing that as long as we know "what" type of handle is in LRESULT or lParam/wParam we can cast back into it.
For example
case WM_CREATE:
...
//create a window
//lParam is the CREATESTRUCT for new window created here
....
return lParam;
...
...
CREATESTRUCT cStruct = (CREATESTRUCT)SendMessage(hwnd, msg /*WM_CREATE*/);
cStrcut.cx;//this is the width of the new window?
correct?
Is this is "correct"? Can anyone provide me and the StaticOverflow community a short thesis on this technique/idiom?
Questions: Should we only return lParam (or only wParam) values? Are there any pitfalls one should know about? Both LRESULT and LPARAM are LONG_PTR types, which are 32 or 64 bit integers. I'm not a seasoned C programmer, but it appears these integers are just being used as "buffers" which the programmer later casts into their "real" type before using... sound accurate?
nor 'code' '/code' so I can't be precise. But SendMessage places the WindowProcedure on the stack and returns w/e the WindowProc does as an LRESULT. – Trae Barlow Apr 21 '13 at 08:37