Gui Autosize problem with child gui window, weird behavior.

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
truekefir
Posts: 17
Joined: 29 Jul 2017, 13:57

Gui Autosize problem with child gui window, weird behavior.

13 Oct 2017, 01:02

Hi,

I was trying to make a cutrom titlebar with some extra features but I got stuck with a problem,
every time I use "Gui, titlebar%hwnd%: Show, AutoSize" it changes the location for gui, is there a bug or I'm doing it wrong?
Commenting "DllCall("SetParent", "uint", Gui_Hwnd, "uint", Win_Hwnd)" fixes the problem but then gui wouldn't move or minimize with parent window.

Also small question about DllCall( "GetParent", "uint", hwnd) it's not supposed to work for ahk gui attached to another application?

Code: Select all

#SingleInstance force

Win_Hwnd := WinExist("ahk_exe Notepad.exe")
WinGetTitle, TitleToShow, ahk_id %Win_Hwnd%
WinGetPos,,,Win_W, Win_H

Gui, titlebar%Win_Hwnd%: New, +LastFound +AlwaysOnTop -Caption -Border +ToolWindow HWNDGui_Hwnd
Gui, Font, s7 c000060, Bold Verdana
Gui, Color, 808080
Gui, Margin, 1, 1
Gui, Add, Text, gGuiMove w84 r1, %TitleToShow%
Gui, Add, Text, gClose x+5, [X]
DllCall("SetParent", "uint", Gui_Hwnd, "uint", Win_Hwnd)
;Gui, Add, Text, % "x+1 h0 w0 vP"
;GuiControlGet, P, Pos
; H := PY + PH
Gui, Show, % "x" Win_W/2 "y" Win_H/2
return

f12::
	MouseGetPos,,, hwnd
Loop, 5
{	
	Gui, titlebar%hwnd%: Add, Text, x1 y+1 r1 W50, 1234567
}
	Gui, titlebar%hwnd%: Show, AutoSize
	Gui, titlebar%hwnd%: +hwndtitlebarshwnd
	;WinSet, Redraw,, ahk_id %titlebarshwnd%
	WinGetPos,win_x,win_y,Win_W, Win_H, ahk_id %titlebarshwnd%
	MsgBox, % "win_x=" win_x " win_y=" win_y " win_W=" win_W " win_H=" win_H " titlebarshwnd=" titlebarshwnd
return

GuiMove:
	PostMessage, 0xA1, 2,,, ahk_id %Gui_Hwnd%
return

Close:
	StringTrimLeft, ParentHwnd, A_GUI, 8
	WinClose, ahk_id %ParentHwnd%
	ExitApp
return
truekefir
Posts: 17
Joined: 29 Jul 2017, 13:57

Re: Gui Autosize problem with child gui window, weird behavior.

13 Oct 2017, 08:25

Code: Select all

Gui, titlebar%hwnd%:Add, Text, % "x+1 y+1 h0 w0 vQ"
GuiControlGet, Q, titlebar%hwnd%:Pos
Gui, titlebar%hwnd%: Show, % "h" QY
using this^ instead of Gui, titlebar%hwnd%: Show, AutoSize for now, it does the job for now
truekefir
Posts: 17
Joined: 29 Jul 2017, 13:57

Re: Gui Autosize problem with child gui window, weird behavior.

06 Nov 2017, 01:05

bumping again, hope someone could help me :)

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: No registered users and 348 guests