[DllImport("user32.dll", SetLastError = true)]
static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
// wait until desktop ready
IntPtr lHwnd = IntPtr.Zero;
do
{
lHwnd = FindWindow("Shell_TrayWnd", null);
Thread.Sleep(100);
} while (lHwnd == IntPtr.Zero);