Click here to Skip to main content
15,913,610 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralEdit control: only works once Pin
jimNLX30-Dec-02 11:26
jimNLX30-Dec-02 11:26 
GeneralRe: Edit control: only works once Pin
Alvaro Mendez30-Dec-02 11:46
Alvaro Mendez30-Dec-02 11:46 
GeneralRe: Edit control: only works once Pin
jimNLX31-Dec-02 5:40
jimNLX31-Dec-02 5:40 
GeneralRe: Edit control: only works once Pin
Alvaro Mendez31-Dec-02 6:32
Alvaro Mendez31-Dec-02 6:32 
GeneralRe: Edit control: only works once Pin
jimNLX31-Dec-02 7:34
jimNLX31-Dec-02 7:34 
GeneralRe: Edit control: only works once Pin
Alvaro Mendez6-Jan-03 17:57
Alvaro Mendez6-Jan-03 17:57 
GeneralRe: Edit control: only works once Pin
Anonymous7-Jan-03 10:30
Anonymous7-Jan-03 10:30 
GeneralOnIdle function eats up 100% of the processor Pin
Florin Ochiana30-Dec-02 10:52
Florin Ochiana30-Dec-02 10:52 
Hi! I have problems with onidle methods that take up 100% of the processor. If I overload the OnIdle method in the main class of my application, without anything in it:

BOOL CtestApp::OnIdle(LONG lCount) {
return TRUE;
}

than after the application starts it eats all the processor. In Windows task manager the CPU Usage is 100%. But if I start using the application (click through the menu, etc) the CPU Usage drops to 10-20 or even lower.
What can I do? I removed the OnIdle method from the main class but I need an OnIdle method in a socket class to receive the messeges as they arrive from the server.

The OnIdle method is started like this: AfxBeginThread(OnIdle2,0);
and it looks like this

UINT OnIdle2(LPVOID pParam) {
int z;
DWORD dwWaitResult;
sockArray[0] = globalSocketHandler;
int wMsg = 190190;
while (OnIdleContinue) {
dwWaitResult = WaitForMultipleObjects(1,sockArray,TRUE,10);
z = WSAAsyncSelect(theApp.socket.GetSock(),AfxGetApp()->GetMainWnd()->GetSafeHwnd(),wMsg,FD_READ);
switch (dwWaitResult) {
case WAIT_OBJECT_0:
//read
strcpy(theApp.socket.buff,"");
theApp.socket.ReadMsg();
break;
default:
TRACE("nothing\n");
//nothing;
break;
}
}
return 1;
}

Thank you for any suggestion.

-----
We are what we repeatedly do. Excellence, then, is not an act, but a habit.

GeneralRe: OnIdle function eats up 100% of the processor Pin
pba_30-Dec-02 11:08
pba_30-Dec-02 11:08 
GeneralRe: OnIdle function eats up 100% of the processor Pin
Paul Oss30-Dec-02 19:35
Paul Oss30-Dec-02 19:35 
GeneralRe: OnIdle function eats up 100% of the processor Pin
Anonymous31-Dec-02 1:35
Anonymous31-Dec-02 1:35 
Generalsemaphores and threads Pin
amica30-Dec-02 10:48
amica30-Dec-02 10:48 
GeneralRe: semaphores and threads Pin
pba_30-Dec-02 11:17
pba_30-Dec-02 11:17 
GeneralName Pipe Error Pin
Spiros30-Dec-02 10:08
Spiros30-Dec-02 10:08 
GeneralCButton text at run time Pin
jimNLX30-Dec-02 9:07
jimNLX30-Dec-02 9:07 
GeneralRe: CButton text at run time Pin
jimNLX30-Dec-02 9:35
jimNLX30-Dec-02 9:35 
GeneralRe: CButton text at run time Pin
Thomas Lau30-Dec-02 18:19
Thomas Lau30-Dec-02 18:19 
QuestionHow do I get process name from handle? Pin
Neil scsn30-Dec-02 8:30
Neil scsn30-Dec-02 8:30 
AnswerRe: How do I get process name from handle? Pin
pba_30-Dec-02 11:03
pba_30-Dec-02 11:03 
GeneralIs this possible.... Pin
Member 9630-Dec-02 7:56
Member 9630-Dec-02 7:56 
GeneralRe: Is this possible.... Pin
Anders Molin30-Dec-02 9:44
professionalAnders Molin30-Dec-02 9:44 
GeneralRe: Is this possible.... Pin
Member 9630-Dec-02 11:05
Member 9630-Dec-02 11:05 
GeneralRe: Is this possible.... Pin
peter271330-Dec-02 12:43
peter271330-Dec-02 12:43 
GeneralRe: Is this possible.... Pin
Member 9630-Dec-02 15:35
Member 9630-Dec-02 15:35 
GeneralFunction required similar to DOS "deltree.exe" Pin
Still learning how to code30-Dec-02 7:45
Still learning how to code30-Dec-02 7:45 

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.