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);