Тема: AHK: Поверх всех окон в Windows 10
Недокументированная CreateWindowInBand.
CreateWindowInBand
This is a private api function found in user32.dll.
CreateWindowInBand function is the same as CreateWindowEx except it has 1 more parameter, dwBand, that is where you specify the band on which the window should stay (ZBID).HWND WINAPI CreateWindowInBand(
DWORD dwExStyle,
LPCWSTR lpClassName,
LPCWSTR lpWindowName,
DWORD dwStyle,
int x,
int y,
int nWidth,
int nHeight,
HWND hWndParent,
HMENU hMenu,
HINSTANCE hInstance,
LPVOID lpParam,
DWORD dwBand);
https://blog.adeltax.com/window-z-order-in-windows-10/
Скрипт надо запускать с Run with UI Access:
#persistent
hwnd := DllCall("CreateWindowInBand", "uint", 0, "str", "Autohotkey", "str", "title", "uint", 0, "int", 0, "int", 0, "int", 200, "int", 200, "ptr", 0, "ptr", 0, "ptr", 0, "ptr", 0, "int", ZBID_UIACCESS := 2, "ptr")
if !a_lasterror
WinShow ahk_id %hwnd%
else
msgbox % a_lasterror
teadrinker определил, что при запуске скрипта через UI ACCESS, опция +AlwaysOnTop устанавливает на гуи ZBID_UIACCESS.
If !RegExMatch(DllCall("GetCommandLine", "Str"), " /restart(?!\S)")
{
If (A_PtrSize = 8)
RunWait "C:\Program Files\AutoHotkey\AutoHotkeyU64_UIA.exe" /restart "%A_ScriptFullPath%"
Else If A_IsUnicode
RunWait "C:\Program Files\AutoHotkey\AutoHotkeyU32_UIA.exe" /restart "%A_ScriptFullPath%"
Else
RunWait "C:\Program Files\AutoHotkey\AutoHotkeyA32_UIA.exe" /restart "%A_ScriptFullPath%"
}
Gui, +HWNDhGui
Gui, Add, Text,, Please enter your name:
Gui, Add, Edit, vName hwndhEdit
Gui, Show, x0 y0
DllCall("GetWindowBand", "ptr", hGui, "uint*", band)
msgbox % band
Gui, +AlwaysOnTop
DllCall("GetWindowBand", "ptr", hGui, "uint*", band)
msgbox % band