Click here to Skip to main content
15,881,882 members
Home / Discussions / C#
   

C#

 
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 
AnswerRe: 'Screen Capture' Performance Improvement Suggestions... Pin
Luc Pattyn17-Jul-09 0:46
sitebuilderLuc Pattyn17-Jul-09 0:46 
GeneralRe: 'Screen Capture' Performance Improvement Suggestions... Pin
Trapper-Hell17-Jul-09 2:28
Trapper-Hell17-Jul-09 2:28 
QuestionString and non english characters Pin
Imtiaz Murtaza16-Jul-09 20:24
Imtiaz Murtaza16-Jul-09 20:24 
AnswerRe: String and non english characters Pin
MarkB77716-Jul-09 20:36
MarkB77716-Jul-09 20:36 
GeneralRe: String and non english characters Pin
PIEBALDconsult17-Jul-09 4:52
mvePIEBALDconsult17-Jul-09 4:52 
GeneralRe: String and non english characters Pin
MarkB77717-Jul-09 14:26
MarkB77717-Jul-09 14:26 
AnswerRe: String and non english characters Pin
PIEBALDconsult17-Jul-09 4:55
mvePIEBALDconsult17-Jul-09 4:55 
GeneralRe: String and non english characters Pin
Imtiaz Murtaza17-Jul-09 7:12
Imtiaz Murtaza17-Jul-09 7:12 
GeneralRe: String and non english characters Pin
PIEBALDconsult17-Jul-09 7:22
mvePIEBALDconsult17-Jul-09 7:22 
QuestionAbout Microsoft ReportViewer Control in MSVS 2008 Pin
elci16-Jul-09 20:11
elci16-Jul-09 20:11 
AnswerRe: About Microsoft ReportViewer Control in MSVS 2008 Pin
sundaramoorthy.b2-Nov-09 19:08
sundaramoorthy.b2-Nov-09 19:08 
QuestionHow to know the proxy connections of the internet explorer in c# Pin
svt gdwl16-Jul-09 19:53
svt gdwl16-Jul-09 19:53 
AnswerRe: How to know the proxy connections of the internet explorer in c# Pin
stancrm16-Jul-09 20:37
stancrm16-Jul-09 20:37 
AnswerRe: How to know the proxy connections of the internet explorer in c# Pin
Giorgi Dalakishvili16-Jul-09 20:54
mentorGiorgi Dalakishvili16-Jul-09 20:54 
QuestionCheck Database Connectivity... Pin
Illegal Operation16-Jul-09 19:52
Illegal Operation16-Jul-09 19:52 

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.