//using System;
//using System.Runtime.InteropServices;
private const uint RDW_INVALIDATE = 0x1U;
[DllImport("user32.dll", SetLastError = true)]
private static extern IntPtr GetDesktopWindow();
[DllImport("user32.dll", SetLastError = true)]
private static extern bool LockWindowUpdate(IntPtr hWndLock);
[DllImport("user32.dll", SetLastError = true)]
private static extern bool RedrawWindow(IntPtr hWnd, HandleRef lprcUpdate, HandleRef hrgnUpdate, uint flags);
public static void RefreshDesktop() {
IntPtr hDesk = GetDesktopWindow();
LockWindowUpdate(hDesk);
RedrawWindow(hDesk, new HandleRef(null, IntPtr.Zero), new HandleRef(null, IntPtr.Zero), RDW_INVALIDATE);
LockWindowUpdate(IntPtr.Zero);
}