Jump to content

  • Log In with Google      Sign In   
  • Create Account

Get Window Size


Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
5 replies to this topic

#1   Members   -  Reputation: 122

Like
Likes
Like

Posted 21 July 2003 - 03:37 PM

Hey everyone. I'm looking to find a way to get the current size/position and other attributes of a window (using Win32+MSVC++6). I know that you can set/get the text of a control with SendMessage(hwnd, WM_GET/SETTEXT...etc), but I've been looking through MSDN and can't find anything like a "WM_GETSIZE" or "WM_GETPOSITION". Is there something like this that im just missing, or is there a whole other way to get size/position information? Thanks. [edited by - dirkduck on July 21, 2003 10:40:37 PM]

#2   Members   -  Reputation: 138

Like
Likes
Like

Posted 21 July 2003 - 03:42 PM

Look up "GetWindowInfo"

#3   Members   -  Reputation: 394

Like
Likes
Like

Posted 21 July 2003 - 03:42 PM

GetWindowRect is what you''re looking for.

#4   Members   -  Reputation: 556

Like
Likes
Like

Posted 21 July 2003 - 03:50 PM


BOOL GetWindowRect(
HWND hWnd, // handle of window
LPRECT lpRect // address of structure for window coordinates
);


Implementation:
RECT windowRect
GetWindowRect(hwnd, &windowRect);

//To access members
windowRect.left
windowRect.right
windowRect.top
windowRect.bottom

#5   Members   -  Reputation: 142

Like
Likes
Like

Posted 21 July 2003 - 03:50 PM

Hi,
Its late and i need sleep, so this may be completely wrong but try this


case WM_SIZE:
cxClient = LOWORD (lParam) ;
cyClient = HIWORD (lParam) ;
SetDlgItemInt(dialog, IDC_SIZE, cxClient, FALSE);
return 0;


you need a dialgo box "dialog" with a text output label called IDC_SIZE but im sure you know that,

im tired - yawn ---- yawn

night!

#6   Members   -  Reputation: 122

Like
Likes
Like

Posted 21 July 2003 - 04:56 PM

Thanks for the replys, I''ll try some of those out.




Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.




PARTNERS