Advertisement

The actual drawable portion in windowed app

Started by March 06, 2003 02:11 AM
2 comments, last by Punx 21 years, 8 months ago
I''m trying to make a windowed directx app and I''ve gotten everything to draw to the screen okay, it''s just the position I''m having problems with. I need a way of finding the portion of the window that is the actual drawable portion. Ex. In Notepad this wouldn''t be the title or the menu but the white space. I want the window to be of any size and of any position so the methods I''ve seen using AdjustWindowRectEx will not work. Is there some easy win32 API function I can use to get the x,y,width,height of the drawable portion of the window?
~punx
GetClientRect()
Advertisement
Well thanks for the help but GetClientRect() is relative to the window so the Top and Left is always 0,0. I need a function or way to get the coordinates of the client area relative to the screen.
~punx
use GetClientRect to get the client rectangle, then you can get the screen coordinates of the top left corner by using ClientToScreen.
RECT rcClient;POINT pt;int modx, mody;GetClientRect( hWnd, rcClient );pt.x = rcClient.left;pt.y = rcClient.top;ClientToScreen( hWnd, pt );modx = pt.left - rcClient.left;mody = pt.top - rcClient.top; 


then you can shift your client based points by modx and mody
MFC uses slightly different versions of these

There is probably an easier way, but this should give you a place to start...
Evillive2

This topic is closed to new replies.

Advertisement