Page 1 of 1

WinGetPos problème avec la taille de l'extérieur de la fenêtre

Posted: 24 Oct 2017, 16:58
by ScottMeyer
Salut,

Je suis embête avec WinGetPos

Ma fenêtre est bien de la taille " A " (voir screenshot) mais WinGetPos me retourne " B " que je mets dans +MinSize du coup c'est faux et dés qu'on redimensionne la fenêtre la taille minimal est plus grande ...

Image

Code: Select all

WinGetPos , X , Y , Gui_Largeur_Mini , Gui_hauteur_Mini , GUI REDIMENSIONNABLE 
Gui, 1: +Resize +MinSize%Gui_Largeur_Mini%x%Gui_hauteur_Mini%  
J'ai déjà essayé un peu tout ça, sans succès : :cry:

Code: Select all

CoordMode, Mouse, Screen
CoordMode, Pixel, Window ; Client
CoordMode, Menu , Window  ;Client
CoordMode, Mouse, Client 
CoordMode, Caret, Window  ; Client
Des idées ?

Re: WinGetPos problème avec la taille de l'extérieur de la fenêtre

Posted: 24 Oct 2017, 17:11
by jeeswg
Avec espoir, cela va résoudre le problème.

Code: Select all

q:: ;window - get position, client area
WinGet, hWnd, ID, A
;e.g. get position
WinGetPos, vWinX, vWinY, vWinW, vWinH, % "ahk_id " hWnd
;e.g. get position client area
JEE_WinGetPosClient(hWnd, vWinX2, vWinY2, vWinW2, vWinH2)
vCoords1 := Format("x{} y{} w{} h{}", vWinX, vWinY, vWinW, vWinH)
vCoords2 := Format("x{} y{} w{} h{}", vWinX2, vWinY2, vWinW2, vWinH2)
MsgBox, % vCoords1 "`r`n" vCoords2
return

JEE_WinGetPosClient(hWnd, ByRef vWinX, ByRef vWinY, ByRef vWinW, ByRef vWinH)
{
	VarSetCapacity(RECT, 16, 0)
	DllCall("user32\GetClientRect", Ptr,hWnd, Ptr,&RECT)
	DllCall("user32\ClientToScreen", Ptr,hWnd, Ptr,&RECT)
	vWinX := NumGet(&RECT, 0, "Int"), vWinY := NumGet(&RECT, 4, "Int")
	vWinW := NumGet(&RECT, 8, "Int"), vWinH := NumGet(&RECT, 12, "Int")
}

Re: WinGetPos problème avec la taille de l'extérieur de la fenêtre  Topic is solved

Posted: 25 Oct 2017, 04:56
by ScottMeyer
Hi jeeswg !

Perfect you are a genie! It works wonderfully
For my part I add just before "WinActivate, %Name_Windows%" not to find a false information.

Thank you very much :clap:

Re: WinGetPos problème avec la taille de l'extérieur de la fenêtre

Posted: 29 Oct 2017, 09:54
by jeeswg
J'ai posté quelques autres fonctions pertinentes ici.
convert coordinates between Client/Screen/Window modes - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=6&t=38472