Click here to Skip to main content
15,890,579 members
Home / Discussions / C#
   

C#

 
AnswerRe: Validation in Multilingual Application using c# Pin
0x3c016-Jul-09 23:36
0x3c016-Jul-09 23:36 
GeneralRe: Validation in Multilingual Application using c# Pin
AmitSumit16-Jul-09 23:43
AmitSumit16-Jul-09 23:43 
GeneralRe: Validation in Multilingual Application using c# Pin
0x3c017-Jul-09 0:27
0x3c017-Jul-09 0:27 
GeneralRe: Validation in Multilingual Application using c# Pin
Luc Pattyn17-Jul-09 0:35
sitebuilderLuc Pattyn17-Jul-09 0:35 
GeneralRe: Validation in Multilingual Application using c# Pin
0x3c017-Jul-09 1:18
0x3c017-Jul-09 1:18 
GeneralRe: Validation in Multilingual Application using c# Pin
Luc Pattyn17-Jul-09 1:23
sitebuilderLuc Pattyn17-Jul-09 1:23 
QuestionHow to access a file in different machine Pin
arun_pk16-Jul-09 23:10
arun_pk16-Jul-09 23:10 
AnswerRe: How to access a file in different machine Pin
Tom Deketelaere16-Jul-09 23:18
professionalTom Deketelaere16-Jul-09 23:18 
QuestionLoad Type in DLL in a different AppDomain Pin
Nandiator16-Jul-09 21:57
Nandiator16-Jul-09 21:57 
AnswerRe: Load Type in DLL in a different AppDomain Pin
JoeSharp16-Jul-09 22:16
JoeSharp16-Jul-09 22:16 
GeneralRe: Load Type in DLL in a different AppDomain Pin
Nandiator17-Jul-09 2:59
Nandiator17-Jul-09 2:59 
AnswerRe: Load Type in DLL in a different AppDomain Pin
PIEBALDconsult17-Jul-09 4:48
mvePIEBALDconsult17-Jul-09 4:48 
GeneralRe: Load Type in DLL in a different AppDomain Pin
Nandiator19-Jul-09 21:23
Nandiator19-Jul-09 21:23 
QuestionPassing values from one form to another form in C#.net using windows application Pin
elci16-Jul-09 21:23
elci16-Jul-09 21:23 
AnswerRe: Passing values from one form to another form in C#.net using windows application Pin
Manas Bhardwaj16-Jul-09 21:47
professionalManas Bhardwaj16-Jul-09 21:47 
AnswerRe: Passing values from one form to another form in C#.net using windows application Pin
musefan16-Jul-09 21:54
musefan16-Jul-09 21:54 
GeneralRe: Passing values from one form to another form in C#.net using windows application Pin
elci16-Jul-09 23:07
elci16-Jul-09 23:07 
AnswerRe: Passing values from one form to another form in C#.net using windows application Pin
DaveyM6916-Jul-09 22:37
professionalDaveyM6916-Jul-09 22:37 
QuestionAdd myuserControl to Window Pin
Satish Pai16-Jul-09 21:06
Satish Pai16-Jul-09 21:06 
AnswerRe: Add myuserControl to Window Pin
Baeltazor16-Jul-09 23:27
Baeltazor16-Jul-09 23:27 
GeneralRe: Add myuserControl to Window Pin
Satish Pai17-Jul-09 1:21
Satish Pai17-Jul-09 1:21 
GeneralRe: Add myuserControl to Window Pin
Baeltazor18-Jul-09 0:51
Baeltazor18-Jul-09 0:51 
Question'Screen Capture' Performance Improvement Suggestions... Pin
Trapper-Hell16-Jul-09 20:35
Trapper-Hell16-Jul-09 20:35 
The main question I have here is how to improve CPU usage... Memory Usage is not an issue Smile | :)

The Client program connects to the server and sends screen shots (at a rate of 250ms) to the server. This all works well, but I need to use less CPU... The server side program is of no concern either Wink | ;)

For brevity purposes, I will simply list what's used. First of all, a TcpClient and a NetworkStream are used. BinaryFormatter serialization is also used to de/serialize objects into byte arrays. The conversion of an object to a string is not quite a choice, since I intend to transfer more objects later on (without having to change much code). A timer with interval of 250ms triggers DoWork method of a BackgroundWorker to take and send a screen shot.

The method used to take the screen shot is:

private Image TakeShot()
        {
            Bitmap bmpScreenShot = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height, PixelFormat.Format32bppArgb);
            Graphics grcShotGraphic = Graphics.FromImage(bmpScreenShot);
            grcShotGraphic.CopyFromScreen(Screen.PrimaryScreen.Bounds.X, Screen.PrimaryScreen.Bounds.Y, 0, 0, Screen.PrimaryScreen.Bounds.Size, CopyPixelOperation.SourceCopy);

            grcShotGraphic.Dispose();
            return (Image)bmpScreenShot;
        }


I just need to know what's causing such CPU usage and how to improve it. E.g. using Threads instead of BackgroundWorker or a more efficient method to take the screen shot. As I have said, Memory Usage and Network load is of no concern. Furthermore, I know that increasing the interval would result in better performance, but I am looking for something other than that. Current CPU usage ranges between 20-40% on an Intel Core 2 Duo E7300 Sigh | :sigh:
AnswerRe: 'Screen Capture' Performance Improvement Suggestions... Pin
stancrm16-Jul-09 20:40
stancrm16-Jul-09 20:40 
GeneralRe: 'Screen Capture' Performance Improvement Suggestions... Pin
Trapper-Hell16-Jul-09 21:50
Trapper-Hell16-Jul-09 21:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.