Window screenshot using WinAPI
Posted
by Evl-ntnt
on Stack Overflow
See other posts from Stack Overflow
or by Evl-ntnt
Published on 2010-05-16T10:33:01Z
Indexed on
2010/05/16
10:40 UTC
Read the original article
Hit count: 299
How to make a screenshot of program window using WinAPI & C#?
I sending WM_PAINT (0x000F)
message to window, which I want to screenshot, wParam = HDC
handle, but no screenshot in my picturebox. If I send a WM_CLOSE
message, all waorking (target window closes). What I do wrong with WM_PAINT
? May be HDC is not PictureBox (WinForms) component? P.S. GetLastError() == ""
[DllImport("User32.dll")]
public static extern Int64 SendMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam);
.....
SendMessage(targetWindowHandle, 0x000F, pictureBox.Handle, IntPtr.Zero);
© Stack Overflow or respective owner