Code: Select all
#Requires AutoHotkey v2.0
#SingleInstance Force
G := Gui("-Caption +ToolWindow")
G.AddText("w300 h200", "Test Gadget")
G.Show("NoActivate")
SetAsDesktopGadget(G.Hwnd)
SetAsDesktopGadget(hWindow) {
DetectHiddenWindows 1
SendMessage(0x052C, 0, 0, , "ahk_id " WinExist("ahk_class Progman"))
For Window in WinGetList("ahk_class WorkerW") {
} Until !DllCall("FindWindowEx", "Ptr", Window, "Ptr", 0, "Str", "SHELLDLL_DefView", "UPtr", 0, "Ptr")
&& hWorkerW := Window
DllCall("SetWindowLongPtr", "Ptr", hWindow, "Int", -8, "Ptr", hWorkerW, "Ptr")
DllCall("SetWindowPos", "uint", hWindow, "uint", hWorkerW, "int", 0, "int", 0, "int", 0, "int", 0, "uint", 0x13)
}