How to take a screenshot of a program window using WinAPI and C #?
I am sending a message WM_PAINT (0x000F)to a window that I want to take off the screen wParam = HDC, but not a screenshot in my box. If I send a message WM_CLOSE, all deviations (target window closes). What am I doing wrong with WM_PAINT? Maybe HDC is not a component of PictureBox (WinForms)? P.SGetLastError() == ""
[DllImport("User32.dll")]
public static extern Int64 SendMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam);
.....
SendMessage(targetWindowHandle, 0x000F, pictureBox.Handle, IntPtr.Zero);
source
share