Monday 28 November 2011

in C programming

How do you determine a Windows program’s client area size?

Your program’s client area size is defined as the height and width of your program’s window that is displayed
on-screen. The client area size can be determined by processing the WM_SIZE message in your program’s event loop. The WM_SIZE message contains three parameters, two of which can be used to determine your client area size. Your program’s event loop (window procedure) is passed a parameter named lParam that can be evaluated when a WM_SIZE message is received. The low-order word of the lParam variable contains your program’s client area width, and the high-order word of the lParam variable contains your program’s client area height. Here is an example of determining client area size:

switch (message)
{
...
case WM_SIZE:
nProgramWidth = LOWORD(lParam);
nProgramHeight = HIWORD(lParam);
...
}

LOWORD and HIWORD are actually macros defined in windows.h that extract the low-order and high-order words, respectively.

Cross Reference:

XXI.20: Can a mouse click be captured in an area outside your program’s client area?

No comments:

Post a Comment