public static Image TakeScreenshotFromObject(
IntPtr hWnd,
bool includeMouse,
PixelFormat pixelFormat = PixelFormat.Format32bppArgb
)
Public Shared Function TakeScreenshotFromObject (
hWnd As IntPtr,
includeMouse As Boolean,
Optional pixelFormat As PixelFormat = PixelFormat.Format32bppArgb
) As Image
Dim hWnd As IntPtr
Dim includeMouse As Boolean
Dim pixelFormat As PixelFormat
Dim returnValue As Image
returnValue = UtilImage.TakeScreenshotFromObject(hWnd,
includeMouse, pixelFormat)
public:
static Image^ TakeScreenshotFromObject(
IntPtr hWnd,
bool includeMouse,
PixelFormat pixelFormat = PixelFormat::Format32bppArgb
)
static member TakeScreenshotFromObject :
hWnd : IntPtr *
includeMouse : bool *
?pixelFormat : PixelFormat
(* Defaults:
let _pixelFormat = defaultArg pixelFormat PixelFormat.Format32bppArgb
*)
-> Image
No code example is currently available or this language may not be supported.
[Missing <param name="includeMouse"/> documentation for "M:DevCase.Core.Media.Graphics.UtilImage.TakeScreenshotFromObject(System.IntPtr,System.Boolean,System.Drawing.Imaging.PixelFormat)"]
No code example is currently available or this language may not be supported.
Dim jpgCodec As ImageCodecInfo =
(From codec As ImageCodecInfo In ImageCodecInfo.GetImageEncoders
Where codec.FormatID = ImageFormat.Jpeg.Guid).Single()
Dim encoderParams As New EncoderParameters(1)
Dim qualityEncoder As Imaging.Encoder = Imaging.Encoder.Quality
Dim qualityParameter As New EncoderParameter(qualityEncoder, 80)
encoderParams.Param(0) = qualityParameter
Dim hwnd As IntPtr = Process.GetProcessesByName("notepad").FirstOrDefault.MainWindowHandle
Dim screenshot As Image = TakeScreenshotFromObject(hwnd, includeMouse:=True)
screenShot.Save("C:\Screenshot.jpg", jpgCodec, encoderParams)
Process.Start("C:\Screenshot.jpg")
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
ArgumentException | The specified handle is not a valid window handle (hWnd). |
ArgumentException | The specified window is hidden. |
Win32Exception |