• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

C++: EzWindows & terminating loop outside the loop

screw3d

Diamond Member
I am doing GUI in C++ through EzWindows.

I have a window with 3 buttons "Start", "Stop" and "Clear".

When I click on start, I will begin a for (I should use while, but I use for loop with usleep so that it won't go on forever if my stop button don't work) that will display some graphics. However, the program would not register a click while the program is running though the loop.

How do I handle this? I don't wanna post the code here as it's kinda long.

TiA

 
>> However, the program would not register a click while the program is running though the loop.

If you are only using one thread, and that thread is busy processing in a loop (or you've put it to sleep) then your process will never empty its windows message queue.

I know how to fix this in MFC but for "EzWindows" you'll need to either do some Googling or Read The Friendly (online) Manual. 🙂
 
Use break; to exit loops.
Yes this would be simple enough if it's done within the loop. Is there a way to force the loops to break from outside the loop, maybe introducing a true condition from outside the loop?
 
Originally posted by: marvie
Use break; to exit loops.
Yes this would be simple enough if it's done within the loop. Is there a way to force the loops to break from outside the loop, maybe introducing a true condition from outside the loop?
exactly. Then in your loop

if (some_global_flag)
exit

(assuming your windows message queue is being emptied so your other button message handler runs to set the global flag)
 
I know how to fix this in MFC but for "EzWindows" you'll need to either do some Googling or Read The Friendly (online) Manual.

All I found is the hardcopy, where's could I find some online stuff on EzWindows? Google only returned lots of homework assignments from lotsa of universities!

Or could anyone give me an idea on how to fix this?

Thanks
 
Back
Top