Reputation: 61
I am using CodeBlocks to complie my c++ programs.
When I run the .exe file and click on the window, the program is stopping (is that normal ?).
How do I prevent the program to stop when I click on it ? Or how do I make the program continue after clicking on it ?
EDIT: for example with this minimal code
#include <iostream>
int main()
{
while (true)
std::cout << "*";
}
When I run the program, it should run endlessly, but whenever I leftclick inside the window opened by the program, it kills the program. Is that intended, or is that to some sort of bug ?
Upvotes: 2
Views: 1574
Reputation: 28241
It doesn't "kill" your program; it only suspends it. You can press Enter, and your program will resume.
This is a feature of Windows. When it runs a program in the console (aka the "black window"), it lets you grab the output of the program by selecting a rectangular region by dragging with the left mouse button.
This is what annoys you. Windows thinks you want to select a region in the output window, but you don't want to do it - you only want to click the window (e.g. to bring it above other windows). To fix this, disable the "Quick Edit" mode by right-clicking on the window's title, and Choosing "Properties", "Options", "Edit Options", "QuickEdit Mode".
It seems that Windows remembers this setting, so you only need to do it "once" (until you decide that you actually need this feature back).
Upvotes: 4