I’m trying to animate a GUI with rounded corners using the FrameShadow function by Klark92 and the AnimateWindow function, but they don't seem to work well together. Only the "text layer" moves, not the entire GUI. Is there a solution? I'd like to know before I attempt to manually recreate the animations with loop and move. Thanks
Code: Select all
#Requires AutoHotkey v2
#SingleInstance
g := Gui('-Caption +AlwaysOnTop')
g.SetFont('s30')
g.Add('Text',, 'GUI with rounded corners`npositioned at the bottom right.')
g.Show('Hide')
WinGetPos(&gx, &gy, &gW, &gH, g)
FrameShadow(g.hwnd)
g.Show('x' A_ScreenWidth - gW - 15 'y' A_ScreenHeight - gH - 75)
SetTimer((*) => DllCall('AnimateWindow', 'Ptr', g.hwnd, 'Int', 1500, 'Int', '0x50001'), -3000) ; Slide out Left to Right. (AW_SLIDE | AW_HOR_POSITIVE | AW_HIDE)
; SetTimer((*) => SlideoutLefttoRight(), -3000)
; FrameShadow by Klark92. https://www.autohotkey.com/boards/viewtopic.php?f=6&t=29117&hilit=FrameShadow
FrameShadow(hwnd)
{
DllCall("dwmapi.dll\DwmIsCompositionEnabled", "int*", &dwmEnabled:=0)
if !dwmEnabled {
DllCall("user32.dll\SetClassLongPtr", "ptr", hwnd, "int", -26, "ptr", DllCall("user32.dll\GetClassLongPtr", "ptr", hwnd, "int", -26) | 0x20000)
}
else {
margins := Buffer(16, 0)
NumPut("int", 1, "int", 1, "int", 1, "int", 1, margins)
DllCall("dwmapi.dll\DwmSetWindowAttribute", "ptr", hwnd, "Int", 2, "Int*", 2, "Int", 4)
DllCall("dwmapi.dll\DwmExtendFrameIntoClientArea", "ptr", hwnd, "ptr", margins)
}
}
;============================================================================================
SlideoutLefttoRight() {
g.GetPos(&ix, &iy, &w, &h)
while (ix < A_ScreenWidth) {
ix += 10
g.Move(ix / (A_ScreenDPI / 96))
Sleep(10)
}
ExitApp()
}