#Requires AutoHotkey v2.0
DirSelect()
f1::SetFileDiolLogPath("C:\Program Files")
f2::SetFileDiolLogPath("C:\Windows")
SetFileDiolLogPath(path) {
if hwnd := WinActive("浏览文件夹 ahk_class #32770")
SendMessage(0x0467, true, strptr(path), hwnd)
}
/*
#Include <RemoteProcess>
DirSelect()
f1::SetFileDialogPath("C:\Program Files")
f2::SetFileDialogPath("C:\Program Files (x86)")
SetFileDialogPath(path) {
if hwnd := WinActive("浏览文件夹 ahk_class #32770") {
if hwndTreeView := ControlGetHwnd("SysTreeView321", hwnd) {
pid := WinGetPID(hwndTreeView)
if DllCall("GetCurrentProcessId", "uint") !== pid {
ps := RemoteProcess.FromProcessId(pid)
pPath := ps.Alloc(StrPut(path))
ps.WriteWString(pPath, path)
SendMessage(0x0467, 1, pPath, hwnd)
ps.Free(pPath)
}
else {
SendMessage(0x0467, 1, StrPtr(path), hwnd)
}
hItem := SendMessage(0x110A, 9, 0, hwndTreeView)
SendMessage(0x1102, 2, hItem, hwndTreeView)
SendMessage(0x110B, 5, hItem, hwndTreeView)
}
}
}
*/
声明:站内资源为整理优化好的代码上传分享与学习研究,如果是开源代码基本都会标明出处,方便大家扩展学习路径。请不要恶意搬运,破坏站长辛苦整理维护的劳动成果。本站为爱好者分享站点,所有内容不作为商业行为。如若本站上传内容侵犯了原著者的合法权益,请联系我们进行删除下架。

评论(0)