The c# code below can be used to capture the screen .
Combined with the filesystemwatcher class ,this code can be used to monitor user activities on a computer.You can also add a timer to this method to capture the screen at regular intervals or you can use a simple client -server application to transfer the captured images to an e-mail account.
In a nutshell u can use this method depending on your needs.
Any corrections or critics corncerning this code is warmly welcomed.

private static Image CaptureScreen()
{
Size s=Screen.PrimaryScreen.Bounds.Size;
 Bitmap bmp=new Bitmap(S.Width,S.height);
Graphics g=Graphics.FromImage(bmp);
g.CopyFromScreen(0,0,0,0,s);
return bmp;
}

Looks reasonable, only thing that might be usefulw ould be what if its not the primary screen ?

Any corrections or critics corncerning this code is warmly welcomed.

private static Image CaptureScreen()
{
Size s=Screen.PrimaryScreen.Bounds.Size;
 Bitmap bmp=new Bitmap(S.Width,S.height);
Graphics g=Graphics.FromImage(bmp);
g.CopyFromScreen(0,0,0,0,s);
return bmp;
}

i diden't test the code .. but one thing that i see of the top is the use of bitmap in the width , height of the screen. So just stop for a second and think about it.. 1280 x 800, that's my screen resolution , now saved as a 24-bit bitmap it's 3 mb just there... streaming it down the pipe will take some time ... so that's buffering for you... and just then the second screen shot comes along the way ... so that's gonna remain memory resident for a while, and so on and so on.... : MY point is... use jpeg format or resize the bitmap... or you must really have a fast network stream.

Thanks miculnegru for your correction.
God bless u

I am trying to capture a DOS based Qbasic image using the "screen2" command and copy to the clipboard. In all versions of Windows up through 2000, this works by doing "ALT-PRTSCREEN". However, in XP and VISTA it doesn't. The image appears on the screen correctly but you can't copy it to the clipboard. Thanks for any help with this.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.