Well, back again to the OP.
In other words: The X and Y coordinates of the upper left corner of the window's non-client area / the windows's frame.
This has been no problem with prior versions of Windows, because the whole frame was visible. With at least Win 10 (I don't remember what Win 8.1 did)
decided to make parts of the frame on left, bottom and right sides transparent respectively invisible. But these parts still react on mouse events and are still parts of the frame. So positioning the
at 0, 0 will result in a visible 'gap' on the left side caused by the unvisible/transparent frame.
Code: Select all
#NoEnv
Gui, +LastFound +AlwaysOnTop +hwndHGUI +OwnDialogs
Gui, Margin, 20, 20
Gui, Font, s10, Lucida Console
Gui, Add, Text, Section, Title:
Gui, Add, Text, xp y+5,Class:
Gui, Add, Text, xp y+5,Window X-Pos:
Gui, Add, Text, xp y+5, Window Y-Pos:
Gui, Add, Text, xp y+5, Window Width:
Gui, Add, Text, xp y+5, Window Height:
Gui, Add, Text, xp y+5, Client X-Pos:
Gui, Add, Text, xp y+5, Client Y-Pos:
Gui, Add, Text, xp y+5, Client Width:
Gui, Add, Text, xp y+5, Client Height:
Gui, Add, Text, xp y+5, Style:
Gui, Add, Text, xp y+5, ExStyle:
Gui, Add, Text, xp y+5, State:
Gui, Add, Text, xp y+5, Border Width:
Gui, Add, Text, xp y+5, Border Height:
Gui, Add, Text, xp y+5, Type:
Gui, Add, Text, xp y+5, Version:
Gui, Add, Text, vTitle ys w200
Gui, Add, Text, vClass xp y+5 wp
Gui, Add, Text, vWX xp y+5 wp
Gui, Add, Text, vWY xp y+5 wp
Gui, Add, Text, vWW xp y+5 wp
Gui, Add, Text, vWH xp y+5 wp
Gui, Add, Text, vCX xp y+5 wp
Gui, Add, Text, vCY xp y+5 wp
Gui, Add, Text, vCW xp y+5 wp
Gui, Add, Text, vCH xp y+5 wp
Gui, Add, Text, vStyle xp y+5 wp
Gui, Add, Text, vExStyle xp y+5 wp
Gui, Add, Text, vState xp y+5 wp
Gui, Add, Text, vBW xp y+5 wp
Gui, Add, Text, vBH xp y+5 wp
Gui, Add, Text, vType xp y+5 wp
Gui, Add, Text, vVersion xp y+5 wp
Gui, Add, Button, xm gAddResize vBtnResize, Remove sizing border
GuiControl, , BtnResize, Add sizing border
Gui, Show, , GetWindowInfo()
WinMove, 0, 0
WindowInfo := GetWindowInfo(HGUI)
Update_GUI(WindowInfo)
Return
GuiClose:
ExitApp
AddResize:
Gui, +OwnDialogs
GuiControlGet, BtnResize
If (SubStr(BtnResize, 1, 3) = "Add") {
Gui, +Resize
GuiControl, , BtnResize, Remove sizing border
}
Else {
Gui, -Resize
GuiControl, , BtnResize, Add sizing border
}
WinMove, 0, 0
WindowInfo := GetWindowInfo(HGUI)
Update_GUI(WindowInfo)
Sleep, 1000
WinMove, , , 0, 0, % WindowInfo.WindowW, % WindowInfo.WindowH
Return
Update_GUI(WindowInfo) {
GuiControl, , Title, % WindowInfo.Title
GuiControl, , Class, % WindowInfo.Class
GuiControl, , WX, % WindowInfo.WindowX
GuiControl, , WY, % WindowInfo.WindowY
GuiControl, , WW, % WindowInfo.WindowW
GuiControl, , WH, % WindowInfo.WindowH
GuiControl, , CX, % WindowInfo.ClientX
GuiControl, , CY, % WindowInfo.ClientY
GuiControl, , CW, % WindowInfo.ClientW
GuiControl, , CH, % WindowInfo.ClientH
GuiControl, , Style, % Format("0x{:08X}", WindowInfo.Style)
GuiControl, , ExStyle, % Format("0x{:08X}", WindowInfo.ExStyle)
GuiControl, , State, % WindowInfo.State
GuiControl, , BW, % WindowInfo.BorderW
GuiControl, , BH, % WindowInfo.BorderH
GuiControl, , Type, % WindowInfo.Type
GuiControl, , Version, % WindowInfo.Version
WinGetPos, X, Y, W, H
MsgBox, 0, WInGetPos, X: %X% - Y:%Y% - W: %W% - H:%H%
}
; #FUNCTION# =======================================================================================
; Name...........: GetWindowInfo
; Description ...: Provides an object for the passed window handle containing the values retrieved
; by the API function GetWindowInfo() and additionally the window title and class.
; Syntax.........: GetWindowInfo(HWND)
; Parameters ....: HWND - handle (HWND) to the window.
; Return values .: On failure: False
; on success: Object with the following keys:
; - Title : window title
; - Class : window class
; - WindowX : x-position of the window (screen coordinates - pixels)
; - WindowY : y-position of the window
; - WindowW : width of the window
; - WindowH : height of the window
; - ClientX : x-position of the client area
; - ClientY : y-position of the client area
; - ClientW : width of the client area
; - ClientH : height of the client area
; - Style : styles
; - ExStyle : extended styles
; - State : state (1 = active)
; - BorderW : width of the vertical frame (pixels)
; - BorderH : height o the horizontal frame (pixels)
; - Type : "The window class atom (see RegisterClass)."
; - Version : "The Windows version of the application that created the window."
; Author ........: ich_L (de.autohotkey.com)
; Modified.......:
; Remarks .......:
; Related .......:
; Link ..........: http://msdn.microsoft.com/en-us/library/ms633516%28VS.85%29.aspx
; Example .......:
; ==================================================================================================
GetWindowInfo(HWND) {
If !(A_PtrSize) {
MsgBox, 16, %A_ThisFunc%, Diese Funktion benötigt AHK_L+!
Return False
}
If !WinExist("ahk_id" . HWND)
Return False
WinGetTitle, Title
WinGetClass, Class
; Struct WINDOWINFO
NumPut(VarSetCapacity(struct_WI, 60, 0), struct_WI)
If !DllCall("User32\GetWindowInfo", "Ptr", HWND, "Ptr", &struct_WI)
Return False
; Object WindowInfo
obj_WI := Object()
obj_WI.Title := Title
obj_WI.Class := Class
obj_WI.WindowX := NumGet(struct_WI, 4, "Int")
obj_WI.WindowY := NumGet(struct_WI, 8, "Int")
obj_WI.WindowW := NumGet(struct_WI, 12, "Int") - obj_WI.WindowX
obj_WI.WindowH := NumGet(struct_WI, 16, "Int") - obj_WI.WindowY
obj_WI.ClientX := NumGet(struct_WI, 20, "Int")
obj_WI.ClientY := NumGet(struct_WI, 24, "Int")
obj_WI.ClientW := NumGet(struct_WI, 28, "Int") - obj_WI.ClientX
obj_WI.ClientH := NumGet(struct_WI, 32, "Int") - obj_WI.ClientY
obj_WI.Style := NumGet(struct_WI, 36, "UInt")
obj_WI.ExStyle := NumGet(struct_WI, 40, "UInt")
obj_WI.State := NumGet(struct_WI, 44, "UInt")
obj_WI.BorderW := NumGet(struct_WI, 48, "UInt")
obj_WI.BorderH := NumGet(struct_WI, 52, "UInt")
obj_WI.Type := NumGet(struct_WI, 56, "UShort")
obj_WI.Version := NumGet(struct_WI, 58, "UShort")
Return obj_WI
}
Edit: No mystery, I overlooked that Windows is adjusting the dimensions of the client area.
For me, it's definitely no AHK bug.