I coded the code below. I’ve used it in my program and it seems to work.
Anyway, I’m asking if is it correct.
int SendMessageWMSIZE(HWND hwnd) {
RECT rc;
GetClientRect(hwnd,&rc);
int lParam_my;
short low=rc.right-rc.left; // LOWORD
short high=rc.bottom-rc.top; // HIWORD
lParam_my=(high<<16)|low; // construct an int 32 from two int 16
SendMessage(hwnd, WM_SIZE, 0, lParam_my);
return lParam_my;
}
Don’t I have to change the “short” with “int” (I can shift an 32 int by 16, but shifting a 16 by 16)?
Why it works either if I use “short” or “int” instead of shorts?
It would be more idiomatic to use the
MAKELPARAMmacro.