Click here to Skip to main content
15,910,981 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: message loop + event Pin
Vlasta_12-Feb-09 1:46
Vlasta_12-Feb-09 1:46 
QuestionBest sleep() method in while loop? Pin
notiter12-Feb-09 0:15
notiter12-Feb-09 0:15 
AnswerRe: Best sleep() method in while loop? Pin
_AnsHUMAN_ 12-Feb-09 0:26
_AnsHUMAN_ 12-Feb-09 0:26 
AnswerRe: Best sleep() method in while loop? Pin
Eytukan12-Feb-09 0:38
Eytukan12-Feb-09 0:38 
AnswerRe: Best sleep() method in while loop? Pin
Roger Stoltz12-Feb-09 1:30
Roger Stoltz12-Feb-09 1:30 
GeneralRe: Best sleep() method in while loop? Pin
Eytukan12-Feb-09 2:25
Eytukan12-Feb-09 2:25 
GeneralRe: Best sleep() method in while loop? Pin
Roger Stoltz12-Feb-09 2:40
Roger Stoltz12-Feb-09 2:40 
AnswerRe: Best sleep() method in while loop? Pin
Rajesh R Subramanian12-Feb-09 3:33
professionalRajesh R Subramanian12-Feb-09 3:33 
The UI would appear to be frozen because your application is busy processing roger() function. One way (from the book: "Ugliest things to do") is to do the dirty stuff manually, but I said it is dirty.

Put this within your while loop:
MSG Msg;
while(::PeekMessage(&Msg, NULL, 0, 0, PM_NOREMOVE))
{
   AfxPumpMessage();
}

I've assumed you're using MFC, if you're not, you can still call up on TranslateMessage and DispatchMessage (which would make it dirtier)

This would manually pump message during every iteration of the loop and your application's UI won't appear frozen. *BUT*, you must do such things on a separate thread, like everyone else said.


It is a crappy thing, but it's life -^ Carlo Pallini

GeneralRe: Best sleep() method in while loop? Pin
Roger Stoltz12-Feb-09 4:02
Roger Stoltz12-Feb-09 4:02 
GeneralRe: Best sleep() method in while loop? Pin
Rajesh R Subramanian12-Feb-09 4:46
professionalRajesh R Subramanian12-Feb-09 4:46 
GeneralRe: Best sleep() method in while loop? Pin
Eytukan12-Feb-09 6:05
Eytukan12-Feb-09 6:05 
QuestionSplitter window with RichEditView Pin
gopalraja12-Feb-09 0:06
gopalraja12-Feb-09 0:06 
AnswerRe: Splitter window with RichEditView Pin
Stuart Dootson12-Feb-09 0:31
professionalStuart Dootson12-Feb-09 0:31 
QuestionHow do we Inherit struct from another struct in IDL file Pin
Gopal_Kanchana11-Feb-09 23:44
Gopal_Kanchana11-Feb-09 23:44 
AnswerRe: How do we Inherit struct from another struct in IDL file Pin
CPallini12-Feb-09 0:09
mveCPallini12-Feb-09 0:09 
GeneralRe: How do we Inherit struct from another struct in IDL file Pin
Gopal_Kanchana12-Feb-09 0:18
Gopal_Kanchana12-Feb-09 0:18 
GeneralRe: How do we Inherit struct from another struct in IDL file Pin
CPallini12-Feb-09 0:30
mveCPallini12-Feb-09 0:30 
Questionstring replacement using c preprocessor Pin
tarcairion11-Feb-09 22:43
tarcairion11-Feb-09 22:43 
AnswerRe: string replacement using c preprocessor Pin
Iain Clarke, Warrior Programmer11-Feb-09 22:52
Iain Clarke, Warrior Programmer11-Feb-09 22:52 
GeneralRe: string replacement using c preprocessor Pin
tarcairion11-Feb-09 23:04
tarcairion11-Feb-09 23:04 
GeneralRe: string replacement using c preprocessor Pin
Stuart Dootson11-Feb-09 23:28
professionalStuart Dootson11-Feb-09 23:28 
AnswerRe: string replacement using c preprocessor Pin
Naveen11-Feb-09 23:10
Naveen11-Feb-09 23:10 
GeneralRe: string replacement using c preprocessor Pin
tarcairion11-Feb-09 23:34
tarcairion11-Feb-09 23:34 
GeneralRe: string replacement using c preprocessor Pin
Naveen11-Feb-09 23:41
Naveen11-Feb-09 23:41 
AnswerRe: string replacement using c preprocessor Pin
Stuart Dootson11-Feb-09 23:13
professionalStuart Dootson11-Feb-09 23:13 

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.