[ComImport]
[Guid("F490EB00-1240-11D1-9888-006097DEACF9")]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IActiveDesktop
{
[PreserveSig]
int ApplyChanges(AD_Apply dwFlags);
[PreserveSig]
int GetWallpaper([MarshalAs(UnmanagedType.LPWStr)] System.Text.StringBuilder pwszWallpaper,
int cchWallpaper,
int dwReserved);
[PreserveSig]
int SetWallpaper([MarshalAs(UnmanagedType.LPWStr)] string pwszWallpaper, int dwReserved);
[PreserveSig]
int GetWallpaperOptions(ref WALLPAPEROPT pwpo, int dwReserved);
[PreserveSig]
int SetWallpaperOptions(ref WALLPAPEROPT pwpo, int dwReserved);
[PreserveSig]
int GetPattern([MarshalAs(UnmanagedType.LPWStr)] System.Text.StringBuilder pwszPattern, int cchPattern, int dwReserved);
[PreserveSig]
int SetPattern([MarshalAs(UnmanagedType.LPWStr)] string pwszPattern, int dwReserved);
[PreserveSig]
int GetDesktopItemOptions(ref COMPONENTSOPT pco, int dwReserved);
[PreserveSig]
int SetDesktopItemOptions(ref COMPONENTSOPT pco, int dwReserved);
[PreserveSig]
int AddDesktopItem(ref COMPONENT pcomp, int dwReserved);
[PreserveSig]
int AddDesktopItemWithUI(IntPtr hwnd, ref COMPONENT pcomp, DtiAddUI dwFlags);
[PreserveSig]
int ModifyDesktopItem(ref COMPONENT pcomp, ComponentModify dwFlags);
[PreserveSig]
int RemoveDesktopItem(ref COMPONENT pcomp, int dwReserved);
[PreserveSig]
int GetDesktopItemCount(out int lpiCount, int dwReserved);
[PreserveSig]
int GetDesktopItem(int nComponent, ref COMPONENT pcomp, int dwReserved);
[PreserveSig]
int GetDesktopItemByID(IntPtr dwID, ref COMPONENT pcomp, int dwReserved);
[PreserveSig]
int GenerateDesktopItemHtml([MarshalAs(UnmanagedType.LPWStr)] string pwszFileName, ref COMPONENT pcomp, int dwReserved);
[PreserveSig]
int AddUrl(IntPtr hwnd, [MarshalAs(UnmanagedType.LPWStr)] string pszSource, ref COMPONENT pcomp, AddURL dwFlags);
[PreserveSig]
int GetDesktopItemBySource([MarshalAs(UnmanagedType.LPWStr)] string pwszSource, ref COMPONENT pcomp, int dwReserved);
}
<ComImport> _
<Guid("TODO")> _
'TODO: Insert <InterfaceType(ComInterfaceType.InterfaceIsIUnknown)> _ if this doesn't derive from IDispatch
Interface IActiveDesktop
TODO
End Interface
None.
static readonly Guid CLSID_ActiveDesktop = new Guid("{75048700-EF1F-11D0-9888-006097DEACF9}");
public static IActiveDesktop GetActiveDesktop()
{
Type typeActiveDesktop = Type.GetTypeFromCLSID(CLSID_ActiveDesktop);
return (IActiveDesktop) Activator.CreateInstance(typeActiveDesktop);
}
COMPONENTSOPT opts = new COMPONENTSOPT();
opts.dwSize = COMPONENTSOPT.SizeOf;
IActiveDesktop dt = GetActiveDesktop();
dt.GetDesktopItemOptions( ref opts, 0 );