| View previous topic :: View next topic |
| Author |
Message |
IVG
Joined: 21 Mar 2007 Posts: 20 Location: Lithuania
|
Posted: Sat Mar 24, 2007 1:48 pm Post subject: function WinGetActiveStats |
|
|
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?  |
|
| Back to top |
|
 |
PhiLho
Joined: 27 Dec 2005 Posts: 6721 Location: France (near Paris)
|
Posted: Sat Mar 24, 2007 5:26 pm Post subject: |
|
|
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 |
|
 |
jonny
Joined: 13 Nov 2004 Posts: 3004 Location: Minnesota
|
Posted: Sat Mar 24, 2007 7:25 pm Post subject: Re: function WinGetActiveStats |
|
|
| 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 |
|
 |
IVG
Joined: 21 Mar 2007 Posts: 20 Location: Lithuania
|
Posted: Mon Mar 26, 2007 6:48 am Post subject: |
|
|
| 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 |
|
 |
IVG
Joined: 21 Mar 2007 Posts: 20 Location: Lithuania
|
Posted: Mon Mar 26, 2007 7:00 am Post subject: |
|
|
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  |
|
| Back to top |
|
 |
IVG
Joined: 21 Mar 2007 Posts: 20 Location: Lithuania
|
Posted: Mon Mar 26, 2007 7:11 am Post subject: |
|
|
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 |
|
 |
PhiLho
Joined: 27 Dec 2005 Posts: 6721 Location: France (near Paris)
|
Posted: Mon Mar 26, 2007 9:10 am Post subject: |
|
|
| 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 |
|
 |
IVG
Joined: 21 Mar 2007 Posts: 20 Location: Lithuania
|
Posted: Mon Mar 26, 2007 10:54 am Post subject: |
|
|
My bad
Thank you a lot for help  |
|
| Back to top |
|
 |
|