Click to See Complete Forum and Search --> : How Do I Get the Rect WITHIN a Window?


April 3rd, 1999, 11:22 AM
Ho do I get the Rect dimensions of the drawable area WITHIN a window in MFC/win32? Is there a way to set this- it seems that playing around with a CREATESTRUCT structure's .cx & .cy values just modify the window's dimensions and I need to set or at least determin the area within.

Thanks to one and all!

April 3rd, 1999, 11:48 AM
DO this:

void SomeWindowDerivedClass::YourFunction()
{
RECT rect;

GetClientRect(&rect);
}

rect will then contain the coordinates for the window. It will exclude the area of the window taken up by the menu and title bar.

There is a function similar to GetClientRect which will get that area including the title bar and menu but I forget what it is. The documentation for GetClientRect will probably tell you about it (but I doubt you want that function anyway)