Autohotkey 窗口透明度更改影响活动窗口

Autohotkey 窗口透明度更改影响活动窗口,autohotkey,Autohotkey,我有一个用自动热键隐藏窗口的代码: NumpadEnter:: Trans:=255 Loop { WinSet, Transparent, %Trans%, A Sleep, 20 Trans-=1 if(Trans <= 0) Break } return NumpadEnter:: Trans:=255 环 { WinSet,透明,%Trans%,A 睡吧,20 反式-=1 若(Trans一种方法是使用winexist()

我有一个用自动热键隐藏窗口的代码:

NumpadEnter::
Trans:=255
Loop
{   
    WinSet, Transparent, %Trans%, A
    Sleep, 20
    Trans-=1
    if(Trans <= 0)
        Break
}
return
NumpadEnter::
Trans:=255
环
{   
WinSet,透明,%Trans%,A
睡吧,20
反式-=1

若(Trans一种方法是使用winexist()函数和一个选项作为wintitle参数,那个么将为您提供活动窗口的ID,以便您可以使用它

像这样的

NumpadEnter::
hWnd := WinExist("A")
Trans:=255
Loop
{   
    WinSet, Transparent, %Trans%, Ahk_id %hWnd%
    Sleep, 20
    Trans-=1
    if(Trans <= 0)
        Break
}
return
NumpadEnter::
hWnd:=WinExist(“A”)
Trans:=255
环
{   
WinSet,透明,%Trans%,Ahk_id%hWnd%
睡吧,20
反式-=1
如果(Trans编辑:

完整文件:

编辑2:

您提到它对您不起作用。下面是一个在Windows 8机器上使用Ahk_L(也称为Autohotkey_L或Autohotkey_Lexiko)的工作示例:


您可以使用Windows内置的转换效果dll隐藏窗口。您可以执行许多不同的转换,并且在操作系统处理这些转换时都是平滑的。我明天将发布代码。GoogleThis WinFade()发布您尝试过的代码。它应该可以工作。请参阅下面的工作示例代码。
DetectHiddenWindows, On ;//Allow hidden windows to be detectable
SetWinDelay, -1 ;//Make Window update very fast (smooth animation)

FADE       := 524288
SHOW       := 131072
HIDE       := 65536

FADE_SHOW  := FADE+SHOW
FADE_HIDE  := FADE+HIDE

SetFormat, Integer, Hex
FADE_SHOW+=0 ;//Converts to 0xa0000
FADE_HIDE+=0 ;//Converts to 0x90000
SetFormat, Integer, d

Gui, Font, w500 s35 Center, Verdana
Gui, Add, Text, , Hello! This Window will hide in 5 Seconds.
Gui, Show, NA Hide, Test Window ; //Create the Window hidden
Gui, +LastFound
GUI_ID := WinExist() ;//Get Window ID

Duration := 3000 ;//Speed of Window showing/hiding

DllCall("AnimateWindow","UInt",GUI_ID,"Int",Duration,"UInt", FADE_SHOW) ;//Fade in Window
Sleep, 5000 ;//Pause for 5 seconds
DllCall("AnimateWindow","UInt",GUI_ID,"Int",Duration,"UInt", FADE_HIDE) ;//Fade out Window
Return