How to set User Tile image Windows Server 2012?
- by moontear
I found this nice article of how to add a user tile image via code:
http://joco.name/2010/12/06/i-discovered-the-new-windows-user-tile-api/
This is also explained in depth here: http://msitpros.com/?p=1036
I have problems with doing this in Windows Server 2012. Whenever I run the code:
using System;
using System.Runtime.InteropServices;
namespace FejesJoco
{
class Program
{
[DllImport("shell32.dll", EntryPoint = "#262", CharSet = CharSet.Unicode, PreserveSig = false)]
public static extern void SetUserTile(string username, int whatever, string picpath);
[STAThread]
static void Main(string[] args)
{
SetUserTile(args[0], 0, args[1]);
}
}
}
I get an exception:
Error HRESULT E_FAIL has been returned from a call to a COM component.
Can anyone get this to work and add a user tile image via code?