Steven
Steven

Reputation: 401

AHK: How to change window transparency when window is not active?

I would like to change the GUI to transparent when the window is not active.

Upvotes: 1

Views: 470

Answers (1)

Steven
Steven

Reputation: 401

Add this in the beginning of the code:

OnMessage(0x06, "WM_ACTIVATE") ;TRIGGER FUNCTION WHEN WINDOW'S ACTIVE STATUS IS CHANGED

Add this function to your code:

WM_ACTIVATE()
{
    IfWinActive, MyWindow
        WinSet, Transparent, 255, MyWindow ; TRANSPARENCY OFF
    else
        WinSet, Transparent, 200, MyWindow ; SET TRANSPARENCY BETWEEN 0-255
}

Upvotes: 2

Related Questions