AutoHotkey Community

It is currently May 27th, 2012, 11:22 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: July 4th, 2009, 5:15 pm 
Offline

Joined: February 13th, 2007, 3:54 pm
Posts: 21
I have a window, which size is 486,672. I would like to get the size and the position of the client area, without borders, titlebar etc

Could someone help me?

Wingetpos and controlgetpos failed to do the trick.


Last edited by Futurity on July 4th, 2009, 6:24 pm, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 4th, 2009, 5:26 pm 
Offline

Joined: February 13th, 2007, 3:54 pm
Posts: 21
I was able to get size of the client rect(480,640), but the position is 0,0. How to get the real position?
Code:
VarSetCapacity(rcClient, 16, 0)          ; rcClient Structure
      DllCall("user32\GetClientRect","uint", BREW_HWND
      ,"uint",&rcClient) 
  rcClient_x   := NumGet(rcClient, 0)
  rcClient_y   := NumGet(rcClient, 4)
  rcClient_r   := NumGet(rcClient, 8)
  rcClient_b   := NumGet(rcClient, 12)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 4th, 2009, 5:46 pm 
Do you mean the real position on the screen or within a program? Use the spy for help.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: July 4th, 2009, 6:07 pm 
Offline

Joined: February 13th, 2007, 3:54 pm
Posts: 21
I think I solved the problem:

Code:
  WinGet, hwnd , ID, A
  WinGetPos, , , , Window_Height, ahk_id %hwnd%
  VarSetCapacity(rcClient, 16, 0)          ; rcClient Structure
  DllCall("user32\GetClientRect","uint", hwnd ,"uint",&rcClient) 
  rcClient_x   := NumGet(rcClient, 0)
  rcClient_y   := NumGet(rcClient, 4)
  rcClient_r   := NumGet(rcClient, 8)
  rcClient_b   := NumGet(rcClient, 12)
 
  VarSetCapacity(pwi, 68, 0)
  DllCall("GetWindowInfo", "UInt", hwnd, "UInt", &pwi)
  ;border width
  bx := NumGet(pwi, 48)
  ;border height
  by := NumGet(pwi, 52)
  RealX := bx
  RealY := Window_Height - by - rcClient_b
  RealWidth := rcClient_r
  RealHeight := rcClient_b
  msgbox RealX=%RealX%|RealY=%RealY%|RealWidth=%RealWidth%|RealHeight=%RealHeight%

return


note: you cannot get this info trough spy :(


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 21 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group