Farid-ur-Rahman Farid-ur-Rahman - 1 month ago 7
C# Question

Taking Screen shot continuously without slow down the PC - C#

I have to capture a screen shot continuously after every 250 milliseconds for my program (Similar to Netmeeting). I used the following code:

Image CaptureScreenShot()
{
bmpScreenshot = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height, PixelFormat.Format32bppArgb);
gfxScreenshot = Graphics.FromImage(bmpScreenshot);
gfxScreenshot.CopyFromScreen(Screen.PrimaryScreen.Bounds.X, Screen.PrimaryScreen.Bounds.Y, 0, 0, Screen.PrimaryScreen.Bounds.Size, CopyPixelOperation.SourceCopy);
return bmpScreenshot;
}


To capture the screenshot but it slow the performance of the PC. Where, Netmeeting do not.
Is there any way to get screen shot without slowing the PC?
Code sample will be appreciated

Answer

You won't find a basic answer here. They use much more involved mechanisms for detecting changes on the screen and sending them. Check out how terminal svcs work - http://technet.microsoft.com/en-us/library/cc755399%28WS.10%29.aspx

ideally you are hooking into the GUI and monitoring events, etc. much more advanced than simply screen scraping. If you want to look at less advanced code check out http://www.tightvnc.com

Comments