Page 1 of 1

[solved] Windows are not correctly resized on certain OS

Posted: 03 Dec 2015, 13:54
by bichlepa
Hi, I'm struggeling with a problem of the user Danielsan73 using AutoHotFlow. On his Windows 8 the windows are not moved correctly.
I've already written a test tool in order to localize the problem.

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
#Warn  ; Recommended for catching common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.


gui,1:Default

w:=A_ScreenWidth-50
h:=A_ScreenHeight-200

gui,add,button,w200 h30, A button of a big window
gui,show, x15 y15 w%w% h%h%, GUI 1 Big

gui,2:Default

gui,add,button,w200 h30, OK
gui,show, x30 y10 w220 h50, GUI 2

gui,3:Default
gui,add,text,w200 , some Text
gui,+hwndGUI2HWND
gui,show,,GUI 3
WinMove,ahk_id %GUI2HWND%,,30,140,220, 100

gui,4:default
gui,add,button,,a button
gui,show,,GUI 4
WinMove,GUI 4,,30,350

gui,5:default
gui,add,text,w200 , some Text
gui,add,button,w300 h100,a button
gui,show,,GUI 5

return

1guiclose:
2guiclose:
3guiclose:
4guiclose:
5guiclose:
ExitApp
This are two screenshots: One of Danielsan73:
Image
This is how it looks on my computer:
Image
This are the results of my analysis:
GUI 4 and 5 are same size in both pictures. The sizes of the GUIs were not specified in the script.
GUI 1, 2 and 3 have wrong size. The sizes of the GUIs were either set on creation or they were moved. Although the sizes of GUIs 2 and 3 were set to a specific value, they are not correct. GUI 1 was set to be almost screen-filling, depending of a_screenheight and a_screenwidth. Althoug the values in those build in variables are correct (already tested in an other test script), the GUI becomes too big.

What may be the reason and solution?

Re: Windows are not correctly resized on certain OS

Posted: 03 Dec 2015, 15:49
by joedf
Hmm.... You should set a Minsize and control the position and size of everything on the guisize label. Try using relative positioning and sizing. The screenshots look the same to me :/ ?

Re: Windows are not correctly resized on certain OS

Posted: 03 Dec 2015, 15:58
by guest3456
two options

1. make sure both people are using the same scaling level in Control Panel -> Display

2. use Gui, -DPIScale
https://www.autohotkey.com/docs/command ... m#DPIScale

Re: Windows are not correctly resized on certain OS

Posted: 04 Dec 2015, 02:24
by bichlepa
Thank you, guest3456!
I tried to change the scaling level and this caused the issue. I will use Gui, -DPIScale.