public static Size GetDesktopSize() { int width = USER32.GetSystemMetrics(USER32.SM_CXSCREEN); // width of desktop int height = USER32.GetSystemMetrics(USER32.SM_CYSCREEN); // height of desktop return(new Size(width, height)); }
/// <summary> /// Captures the desktop to a bitmap image /// </summary> /// <returns>bitmap image of the desktop</returns> public static Bitmap Desktop() { int width = USER32.GetSystemMetrics(USER32.SM_CXSCREEN); // width of desktop int height = USER32.GetSystemMetrics(USER32.SM_CYSCREEN); // height of desktop IntPtr desktopHWND = USER32.GetDesktopWindow(); // window handle for desktop return(Window(desktopHWND, 0, 0, width, height)); // return bitmap for desktop } // end method Desktop