AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

function WinGetActiveStats

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
IVG



Joined: 21 Mar 2007
Posts: 20
Location: Lithuania

PostPosted: Sat Mar 24, 2007 1:48 pm    Post subject: function WinGetActiveStats Reply with quote

I use this function (WinGetActiveStats) to get height and width of a window, but where does it think is the begining of a window? Somehow it does not seem to count in the title and menu parts of some windows. Where could the problem be? Confused
Back to top
View user's profile Send private message Send e-mail
PhiLho



Joined: 27 Dec 2005
Posts: 6721
Location: France (near Paris)

PostPosted: Sat Mar 24, 2007 5:26 pm    Post subject: Reply with quote

Works for me: it gives the external size and position of the window on which I tested. Same values as those given by Window Spy and other utilities.
Looks like you get the client rectangle or something like that. Do you have this result whatever the program you are testing?
_________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")
Back to top
View user's profile Send private message Visit poster's website
jonny



Joined: 13 Nov 2004
Posts: 3004
Location: Minnesota

PostPosted: Sat Mar 24, 2007 7:25 pm    Post subject: Re: function WinGetActiveStats Reply with quote

IVG wrote:
I use this function (WinGetActiveStats) to get height and width of a window, but where does it think is the begining of a window? Somehow it does not seem to count in the title and menu parts of some windows.


Reiterating what PhiLho asked about, which windows give these results, and what applications do they belong to?
Back to top
View user's profile Send private message
IVG



Joined: 21 Mar 2007
Posts: 20
Location: Lithuania

PostPosted: Mon Mar 26, 2007 6:48 am    Post subject: Reply with quote

fe notepad, i get possition of the text field, it does not include the menu. And with opera i get the menu, but no title. I can of course use offsets but that various on different programs...
Back to top
View user's profile Send private message Send e-mail
IVG



Joined: 21 Mar 2007
Posts: 20
Location: Lithuania

PostPosted: Mon Mar 26, 2007 7:00 am    Post subject: Reply with quote

Here's the code:

Code:
WinGetActiveStats, strActive, wActive, hActive, xActive, yActive
if (strActive) {
   wActiveS := ceil(wActive/2)
   hActiveS := ceil(hActive/2)
   hwndActive := WinExist(strActive)
   dcActive := GetDC(hwndActive)
   Gui +AlwaysOnTop -Resize +ToolWindow +border +caption
   Gui, Color, 012345
   Gui Show, w%wActiveS% h%hActiveS%, langas
   WinSet, TransColor, 012345
   hwndDest := WinExist("langas")
   dcDest := GetDC(hwndDest)
   SetStretchBltMode(dcActive, 4)
   StretchBlt(dcDest, 0, 0, wActiveS, hActiveS, dcActive, -4, -50, wActive, hActive, 0xCC0020)
   DeleteDC(dcActive)
   DeleteDc(dcDest)
}


I have the gui api in other module so don't mind it Cool
Back to top
View user's profile Send private message Send e-mail
IVG



Joined: 21 Mar 2007
Posts: 20
Location: Lithuania

PostPosted: Mon Mar 26, 2007 7:11 am    Post subject: Reply with quote

Here's how it looks like:



There is a mistake in previous code, I use 0 offsets there:
Code:
StretchBlt(dcDest, 0, 0, wActiveS, hActiveS, dcActive,0,0, wActive, hActive, 0xCC0020)
Back to top
View user's profile Send private message Send e-mail
PhiLho



Joined: 27 Dec 2005
Posts: 6721
Location: France (near Paris)

PostPosted: Mon Mar 26, 2007 9:10 am    Post subject: Reply with quote

GetWindowDC wrote:
The GetWindowDC function retrieves the device context (DC) for the entire window, including title bar, menus, and scroll bars.

_________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")
Back to top
View user's profile Send private message Visit poster's website
IVG



Joined: 21 Mar 2007
Posts: 20
Location: Lithuania

PostPosted: Mon Mar 26, 2007 10:54 am    Post subject: Reply with quote

My bad Smile

Thank you a lot for help Cool
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group