How to setup Windows 7 user tiles via a script I found explained in a blog post. But I do not want the .NET framework dependency this requires, so I try to call it directly via DllCall(). However I cannot get this to work:
#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])
I got a return value of -2147024894 (seems shell32.dll wasn't finding user_tile.jpg). After changing to wstr this returns -2147221008. When I run the code nothing happens (the user tile is not changed).
You could also have asked the author of that blog, he's a helpful guy, I know it because it's me :) You should check if your thread is in an STA apartment. Also you might need to call CoInitialize yourself, in .NET the framework does it for you but it's a prerequisite.