如何通过我在博客文章中找到的脚本设置 Windows 7 用户磁贴。但是我不想要这个需要的 .NET 框架依赖,所以我尝试通过DllCall()直接调用它。但是我不能让它工作:
#RequireAdmin
FileCopy("user_tile.jpg", "C:\Windows\system32\user_tile.jpg")
$rtn = DllCall(@SystemDir & "\shell32.dll", "long", 262, "wstr", "ahiscox", "int", 0, "wstr", "C:\Windows\system32\user_tile.jpg")
MsgBox(16, "DLL Return", $rtn[0])
我得到了 -2147024894 的返回值(似乎 shell32.dll 没有找到 user_tile.jpg)。更改为 wstr 后,返回 -2147221008。当我运行代码时,没有任何反应(用户磁贴未更改)。