not resonding /slow to response any click event
-
I m using multimedia timer in my application but problem is ..application do not reponde to any click event /slow to respond .wht should i do????? thanks
anilaabc wrote:
wht should i do?????
At least provide much more informations because with the info you gave, it is almost impossible to help you. Are you doing heavy processing in the main thread ? Remember that if your main thread is busy, it won't be able to process messages, which means that your UI will not respond.
Cédric Moonen Software developer
Charting control [v1.5] OpenGL game tutorial in C++ -
I m using multimedia timer in my application but problem is ..application do not reponde to any click event /slow to respond .wht should i do????? thanks
-
anilaabc wrote:
wht should i do?????
At least provide much more informations because with the info you gave, it is almost impossible to help you. Are you doing heavy processing in the main thread ? Remember that if your main thread is busy, it won't be able to process messages, which means that your UI will not respond.
Cédric Moonen Software developer
Charting control [v1.5] OpenGL game tutorial in C++ -
Maybe your code is doing something else: posting messages from from control to one other or drawing itself again and again. Make debug out or disable main portions of your code.:~
Greetings from Germany
-
i m doing some calculations in a separate thread after a particalar interval .for this i m using a flag that is set to true in timeproc.I want that UI must repond quickly .I m not doing anything in main thread. Is it enough info ? Thanks in advance
anilaabc wrote:
Is it enough info ?
I'm afraid not :~
anilaabc wrote:
i m doing some calculations in a separate thread after a particalar interval .for this i m using a flag that is set to true in timeproc.
Ok, so when are you starting your processing ? When the user clicks on a button ? If yes, can you post the code for the button click handler (please use the "code block" tag to format your code). Could you describe exactly what happens ? User interaction, when does the UI becomes unresponsive, .. Is the UI completely frozen for a while or just slow ? I think you will need to post relevant part of your code for us to be able to help.
Cédric Moonen Software developer
Charting control [v1.5] OpenGL game tutorial in C++ -
anilaabc wrote:
Is it enough info ?
I'm afraid not :~
anilaabc wrote:
i m doing some calculations in a separate thread after a particalar interval .for this i m using a flag that is set to true in timeproc.
Ok, so when are you starting your processing ? When the user clicks on a button ? If yes, can you post the code for the button click handler (please use the "code block" tag to format your code). Could you describe exactly what happens ? User interaction, when does the UI becomes unresponsive, .. Is the UI completely frozen for a while or just slow ? I think you will need to post relevant part of your code for us to be able to help.
Cédric Moonen Software developer
Charting control [v1.5] OpenGL game tutorial in C++run is set to true. on click i set run=false; to stop thread. when i click run is not set to true and keep on alive to thread void method() { while(run) { if(Draw) { //doing some calculations here } Draw=0; greating_time_id=timeSetEvent(100, 0, GreatingResume_t, (DWORD)this,TIME_ONESHOT); } } }//while end }//end method void CALLBACK GreatingResume_t(UINT uID, UINT uMsg, DWORD dwUser, DWORD dw1, DWORD dw2) { if(uID==greating_time_id) { Draw=1; timeKillEvent(greating_time_id); } }
-
run is set to true. on click i set run=false; to stop thread. when i click run is not set to true and keep on alive to thread void method() { while(run) { if(Draw) { //doing some calculations here } Draw=0; greating_time_id=timeSetEvent(100, 0, GreatingResume_t, (DWORD)this,TIME_ONESHOT); } } }//while end }//end method void CALLBACK GreatingResume_t(UINT uID, UINT uMsg, DWORD dwUser, DWORD dw1, DWORD dw2) { if(uID==greating_time_id) { Draw=1; timeKillEvent(greating_time_id); } }
Just for a test, run "Task Manager" and check "Performance", does your CPU seem overloaded (100% CPU usage)? If so, check "Processes" and see if your process is the one consuming all the CPU time, if so, you have there a run away thread probably. Try putting a Sleep(1) (or maybe Sleep(0)?) in your thread (inside that while-loop) and check if anything changes.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
modified on Thursday, December 4, 2008 7:08 AM