private static void GetTrayWndRect(ref User32.RECT lpRect) { int defaultWidth = 150; int defaultHeight = 30; int hwndShellTray = User32.FindWindow("Shell_TrayWnd", null); if (hwndShellTray != 0) { User32.GetWindowRect(hwndShellTray, ref lpRect); User32.EnumChildProc callback = new User32.EnumChildProc(FindTrayWindow); User32.EnumChildWindows(hwndShellTray, callback, ref lpRect); } else { // OK. Haven't found a thing. Provide a default rect based on the current work // area System.Drawing.Rectangle workArea = SystemInformation.WorkingArea; lpRect.right = workArea.Right; lpRect.bottom = workArea.Bottom; lpRect.left = workArea.Right - defaultWidth; lpRect.top = workArea.Bottom - defaultHeight; } }