Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Gui, Show bug


  • Please log in to reply
3 replies to this topic
majkinetor
  • Moderators
  • 4512 posts
  • Last active: May 20 2019 07:41 AM
  • Joined: 24 May 2006
When setting window dimensions with W and H parameters the actual window.

This is the small example:

_trace := true  ;  , _Trace("_d_")     ;show in SysInternals DebugView

	guipos = x100 y100
[color=blue]	guiw = 100
	guih = 101      [/color]         

	Gui,  +LastFound
	hwnd := WinExist()

	_Trace("bshow", guipos, guiw, guih)
	Gui, Show, %GuiPos% w%GuiW% h%GuiH%, Choose Icons
	WinGetPos, x, y, w, h, ahk_id %hwnd%
	_Trace("ashow  ", "x" x " y" y, w, h)

#include trace.ahk

This is the output log file (trace.log):
11:16:50,459        bshow | x100 y100 | [color=blue]100 | 101[/color]
11:16:50,459        ashow | x100 y100 | [color=blue]106 | 133[/color]

This is the otput from spy:

>>>>>>>>>>( Window Title & Class )<<<<<<<<<<<
Choose Icons
ahk_class AutoHotkeyGUI

>>>>>>>>>>>>( Mouse Position )<<<<<<<<<<<<<
On Screen:	724, 470  (less often used)
In Active Window:	624, 370

>>>>>>>>>( Now Under Mouse Cursor )<<<<<<<<

Color:	0xD8E9EC  (Blue=D8 Green=E9 Red=EC)

>>>>>>>>>>( Active Window Position )<<<<<<<<<<
left: 100     top: 100    [color=blue] width: 106     height: 133[/color]


U can download Trace.ahk here

BTW, notice the milliseconds in log file. Can it possible be that Gui, Show and WinGetPos and 2 _Traces execute at the same millisec ? Or is it AHK sooooo fast... Now, if i check in debug view (uncoment the first line), i see that thick count is indeed very close...
Posted Image

PhiLho
  • Moderators
  • 6850 posts
  • Last active: Jan 02 2012 10:09 PM
  • Joined: 27 Dec 2005

Wn: Specify for n the width (in pixels) of the window's client area (the client area excludes the window's borders, title bar, and menu bar).

Hn: Specify for n the height of the window's client area, in pixels.

You compare overall size with client area...
Posted Image vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")

majkinetor
  • Moderators
  • 4512 posts
  • Last active: May 20 2019 07:41 AM
  • Joined: 24 May 2006
And WinGetPos returns NC area too.... hm... well.. OK.

I supose there is no mean to get client size in AHK beside using DllCall and GetClientRect API ?

VarSetCapacity(sRect, 16)
DllCall("GetClientRect", "uint", hwnd, "uint", &sRect) 	
w := ExtractInteger(sRect, 8), 	h := ExtractInteger(sRect, 12)
WinGetPos, x, y, ,,ahk_id %hwnd%

Posted Image

toralf
  • Moderators
  • 4035 posts
  • Last active: Aug 20 2014 04:23 PM
  • Joined: 31 Jan 2005
I used to calculate it.

At first show the size of the gui (gw,gh) is kwown. With WinGetPos I get the overall size (ow/oh).
The width of the frame is fw := (ow - gw) / 2
The height of the title bar is th := (oh - fw - gh)
Ciao
toralf
 
I use the latest AHK version (1.1.15+)
Please ask questions in forum on ahkscript.org. Why?
For online reference please use these Docs.