- #1
Pipsqueakalchemist
- 138
- 18
- Homework Statement
- Trying to display window GUI but apparently loop blocking event loop
- Relevant Equations
- C++, visual studio
So I've just recently learned what a event loop is and the concept of blocking it. My question is I've written loops before in a console (main()) program and this never happened. Is there something about a GUI program (WinMain()) that makes loops block the event loop?
Also I understand that during the loop, the event loop is forced to wait until the loop is complete and can't execute other task. But if the program is currently in the loop, wouldn't the program encounter the code, tasks that are inside of the loop and be able to execute them?
For example i tried to display a window i made and i put it into a while(1) loop, i had a cin inside the loop so the idea was to keep displaying the window until a i pressed 's' then break out of the loop hence closing the window. But the program was unresponsive. Shouldn't the program encounter my cin because my cin code is inside the loop. i have a picture of my code below.
Appreciate any insight.
Also I understand that during the loop, the event loop is forced to wait until the loop is complete and can't execute other task. But if the program is currently in the loop, wouldn't the program encounter the code, tasks that are inside of the loop and be able to execute them?
For example i tried to display a window i made and i put it into a while(1) loop, i had a cin inside the loop so the idea was to keep displaying the window until a i pressed 's' then break out of the loop hence closing the window. But the program was unresponsive. Shouldn't the program encounter my cin because my cin code is inside the loop. i have a picture of my code below.
Appreciate any insight.