# 【窗口置底】使用ahk脚本使任意窗口嵌入桌面

**URL:** <https://meta.appinn.net/t/topic/41538>\
**Category:** 发现频道\
**Tags:** appinned\
**Created:** [2023 年3 月 12 日 14:10 UTC](https://meta.appinn.net/t/topic/41538 "2023-03-12T14:10:17Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![KagamineTime](https://meta-edge.appinn.com/letter_avatar_proxy/v4/letter/k/4da419/32.png) [@KagamineTime](https://meta.appinn.net/u/KagamineTime)\
**Post date:** [2023 年3 月 13 日 11:36 UTC](https://meta.appinn.net/t/topic/41538/5 "2023-03-13T11:36:59Z")

</div>

尝试用 AutoHotkey v2 写了一下代码～

```auto
!F1:: func_WinAlwaysBottom(WinExist("A"), 1) ; Alt + F1：启用窗口置底（嵌入桌面）
!F2:: func_WinAlwaysBottom(WinExist("A"), 0) ; Alt + F2：禁用窗口置底（嵌入桌面）
func_WinAlwaysBottom(Child_ID, DoOrUndo) {
	If DoOrUndo = 1 { ; 启用窗口置底（嵌入桌面）
		Desktop_ID := WinGetID("ahk_exe explorer.exe ahk_class WorkerW")
		Return DllCall("SetParent", "uint", Child_ID, "uint", Desktop_ID)
	} Else If DoOrUndo = 0 { ; 禁用窗口置底（嵌入桌面）
		Return DllCall("User32\SetParent", "Ptr", Child_ID, "Ptr", 0)
	}
}

```

---

_[View the full topic](https://meta.appinn.net/t/topic/41538)._
