如图,调用MessageBox弹出提示框
我想设计一个弹窗,使得每6000ms后,弹出来的弹窗内容都会发生变化。我注意到MessageBox第二第三个参数接受的可能是string型,然而我试图传入string型参数却发生了错误:
请问有什么方法,可以使得每次弹窗弹出来的内容都会发生变化呢?
代码如下:
#include "windows.h"
#include<time.h>
#include<bits/stdc++.h>
using namespace std;
int main() {
string s = "666";
int i = 0;
int c = 12;
while (i < 10) {
MessageBox(NULL, TEXT("你好"), TEXT("大家好"), MB_OK);
Sleep(6000);
s = to_string(stoi(s) - 1);
++i;
}
}
#include "windows.h"
#include<time.h>
#include<bits/stdc++.h>
using namespace std;
int main() {
string s1="你好",s2="大家好";
//string s = "666";
int i = 0;
int c = 12;
while (i < 10) {
MessageBox(NULL,s1.c_str(),s2.c_str(), MB_OK);
Sleep(6000);
//s = to_string(stoi(s) - 1);
++i;
}
}
int main()
{
string s = "";
char str[100] = "";
int i = 0;
int c = 666;
while (i < 10)
{
sprintf(str, "%s %d", "你好", c - i);
MessageBox(NULL, str, TEXT("大家好"), MB_OK);
Sleep(6000);
// s = to_string(stoi(s) - 1);
++i;
}
return 0;
}
messageBox一般适用于提示用户重要信息,而且必须优先响应(会屏蔽窗体其他部分获得焦点)。你的用法可能不会被支持。