Archived

This topic is now archived and is closed to further replies.

Punx

The actual drawable portion in windowed app

Recommended Posts

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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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...

Share this post


Link to post
Share on other sites