制作一个无限弹窗程序需要使用到C++的多线程和定时器功能。以下是一个简单的示例,使用了C++11标准库中的`
```cpp
#include
#include
#include
#include
std::atomic
void show_window() {
std::cout << "Hello, World!" << std::endl;
}
int main() {
while (running) {
if (!running) {
break;
}
std::this_thread::sleep_for(std::chrono::seconds(1));
show_window();
}
return 0;
}
```
在这个示例中,我们定义了一个全局变量`running`来控制弹窗的显示。当`running`为`true`时,弹窗会显示;当`running`为`false`时,弹窗不会显示。我们使用`std::this_thread::sleep_for`函数来实现定时器功能,每隔一秒弹窗就会显示一次。
要运行这个程序,你需要在命令行中输入以下命令:
```bash
g++ -std=c++11 -pthread main.cpp -o main
./main
```
这将编译并运行你的程序。你可以通过按Ctrl+C来停止程序。