try this originally written by me, but modified by Jose Ines
[DllImport("user32.dll")]
extern static IntPtr GetDesktopWindow();
[System.Runtime.InteropServices.DllImport("user32.d ll")]
private static extern IntPtr GetWindowDC(IntPtr hwnd);
[System.Runtime.InteropServices.DllImport("gdi32.dl l")]
private static extern UInt64 BitBlt
(IntPtr hDestDC,
int x,
int y,
int nWidth,
int nHeight,
IntPtr hSrcDC,
int xSrc,
int ySrc,
System.Int32 dwRop);
with the code of to do it here...
private Image Capture(){
Image myImage = new Bitmap(Screen.PrimaryScreen.Bounds.Width,
Screen.PrimaryScreen.Bounds.Height);
Graphics gr1 = Graphics.FromImage(myImage);
IntPtr dc1 = gr1.GetHdc();
IntPtr dc2 = GetWindowDC(GetDesktopWindow());
BitBlt(dc1, 0, 0, Screen.PrimaryScreen.Bounds.Width,
Screen.PrimaryScreen.Bounds.Height, dc2, 0, 0, 13369376);
gr1.ReleaseHdc(dc1);
return myImage;
}
"Wayne" <Me******@community.nospam> wrote in message
news:uX**************@TK2MSFTNGP11.phx.gbl...
In a Delphi application I would use GetDC passing the handle of the window
I wanted to capture, then with the handle and a caption I would be able to
convert the image to a bitmap. I would like to be able to do this in
C#/.net, but I don't know where to start.
Can someone point me in the right direction?
Thanks
Wayne