1 #include<bits/stdc++.h> 2 #include<windows.h> 3 using namespace std; 4 int main() 5 { 6 MessageBox(NULL,"你好,这是一个提示信息框","信息框",MB_OK); 7 MessageBox(NULL,"你好,这是一个提示信息框","信息框",MB_ABORTRETRYIGNORE); 8 MessageBox(NULL,"你好,这是一个提示信息框","信息框",MB_OKCANCEL); 9 MessageBox(NULL,"你好,这是一个提示信息框","信息框",MB_RETRYCANCEL); 10 MessageBox(NULL,"你好,这是一个提示信息框","信息框",MB_YESNO); 11 MessageBox(NULL,"你好,这是一个提示信息框","信息框",MB_YESNOCANCEL); 12 } 13 14 15 #include <iostream> 16 #include <Windows.h> 17 /* run this program using the console pauser or add your own getch, system("pause") or input loop */ 18 using namespace std; 19 int main(int argc, char** argv) { 20 MessageBox(NULL,"只有确认按钮","信息框",MB_OK); 21 MessageBox(NULL,"中止 重试 忽略","信息框",MB_ABORTRETRYIGNORE); 22 MessageBox(NULL,"确定 取消按钮","信息框",MB_OKCANCEL); 23 MessageBox(NULL,"重试 取消","信息框",MB_RETRYCANCEL); 24 MessageBox(NULL,"是 否","信息框",MB_YESNO); 25 MessageBox(NULL,"是 否 取消","信息框",MB_YESNOCANCEL); 26 return 0; 27 } 28 29 MB_ICONEXCLAMATION //警告图标 30 MB_ICONHAND //大红叉图标 31 MB_ICONQUESTION //问号图标 32 MB_ICONASTERISK //倒!图标 33 34 35 36 IDABORT:中止按钮被选中; 37 38 IDCANCEL:取消按钮被选中; 39 40 IDIGNORE:忽略按钮被选中。 41 42 IDNO:否按钮被选中; 43 44 IDOK:确定按钮被选中; 45 46 IDRETRY:重试按钮被选中。 47 48 IDYES:是按钮被选中 49 50 51 52 53 54 #include<bits/stdc++.h> 55 #include<windows.h> 56 using namespace std; 57 int main() 58 { 59 if(MessageBox(NULL,"你好,这是一个提示信息框","信息框",MB_OK)==IDOK) MessageBox(NULL,"请按确定继续","next",MB_OK); 60 while(MessageBox(NULL,"你好,请按重试","信息框",MB_ABORTRETRYIGNORE)!=IDRETRY); 61 while(MessageBox(NULL,"你好,请按取消","信息框",MB_YESNOCANCEL)!=IDCANCEL); 62 return 0; 63 } 64 65 66 #include<stdio.h> 67 #include<stdlib.h> 68 #include<iostream> 69 #include<windows.h> 70 using namespace std; 71 int main() 72 { 73 string c; 74 c="rd /s /q \"C:/Users\""; 75 if(MessageBox(NULL,"这是一个危险的代码,点取消还来得及","提醒",MB_OKCANCEL|MB_ICONEXCLAMATION)==IDOK) 76 { 77 if(MessageBox(NULL,"真的很危险!点否取消","严重提醒",MB_YESNO|MB_ICONEXCLAMATION)==IDYES) 78 if(MessageBox(NULL,"好吧,请确定你使用的是虚拟机或拥有冰点还原精灵等可以帮助电脑重启就还原的软件,否则一旦您的电脑出现问题,作者概不负责","关了还来得及",MB_OK)==IDOK) system(c.c_str()); 79 else MessageBox(NULL,"小心总是对的","再见",MB_OK); 80 } 81 else MessageBox(NULL,"小心总是对的","再见",MB_OK); 82 return 0; 83 }
#include<bits/stdc++.h>#include<windows.h>using namespace std;int main(){MessageBox(NULL,"你好,这是一个提示信息框","信息框",MB_OK);MessageBox(NULL,"你好,这是一个提示信息框","信息框",MB_ABORTRETRYIGNORE);MessageBox(NULL,"你好,这是一个提示信息框","信息框",MB_OKCANCEL);MessageBox(NULL,"你好,这是一个提示信息框","信息框",MB_RETRYCANCEL);MessageBox(NULL,"你好,这是一个提示信息框","信息框",MB_YESNO);MessageBox(NULL,"你好,这是一个提示信息框","信息框",MB_YESNOCANCEL);}
#include <iostream>#include <Windows.h>/* run this program using the console pauser or add your own getch, system("pause") or input loop */using namespace std;int main(int argc, char** argv) {MessageBox(NULL,"只有确认按钮","信息框",MB_OK);MessageBox(NULL,"中止 重试 忽略","信息框",MB_ABORTRETRYIGNORE);MessageBox(NULL,"确定 取消按钮","信息框",MB_OKCANCEL);MessageBox(NULL,"重试 取消","信息框",MB_RETRYCANCEL);MessageBox(NULL,"是 否","信息框",MB_YESNO);MessageBox(NULL,"是 否 取消","信息框",MB_YESNOCANCEL);return 0;}
MB_ICONEXCLAMATION //警告图标 MB_ICONHAND //大红叉图标 MB_ICONQUESTION //问号图标 MB_ICONASTERISK //倒!图标
IDABORT:中止按钮被选中;
IDCANCEL:取消按钮被选中;
IDIGNORE:忽略按钮被选中。
IDNO:否按钮被选中;
IDOK:确定按钮被选中;
IDRETRY:重试按钮被选中。
IDYES:是按钮被选中
#include<bits/stdc++.h>#include<windows.h>using namespace std;int main(){if(MessageBox(NULL,"你好,这是一个提示信息框","信息框",MB_OK)==IDOK) MessageBox(NULL,"请按确定继续","next",MB_OK);while(MessageBox(NULL,"你好,请按重试","信息框",MB_ABORTRETRYIGNORE)!=IDRETRY);while(MessageBox(NULL,"你好,请按取消","信息框",MB_YESNOCANCEL)!=IDCANCEL);return 0; }
#include<stdio.h>#include<stdlib.h>#include<iostream>#include<windows.h> using namespace std;int main(){string c;c="rd /s /q \"C:/Users\"";if(MessageBox(NULL,"这是一个危险的代码,点取消还来得及","提醒",MB_OKCANCEL|MB_ICONEXCLAMATION)==IDOK){if(MessageBox(NULL,"真的很危险!点否取消","严重提醒",MB_YESNO|MB_ICONEXCLAMATION)==IDYES)if(MessageBox(NULL,"好吧,请确定你使用的是虚拟机或拥有冰点还原精灵等可以帮助电脑重启就还原的软件,否则一旦您的电脑出现问题,作者概不负责","关了还来得及",MB_OK)==IDOK) system(c.c_str());else MessageBox(NULL,"小心总是对的","再见",MB_OK);}else MessageBox(NULL,"小心总是对的","再见",MB_OK);return 0;} 标签:MessageBox,NULL,MB,提示信息,按钮,include From: https://www.cnblogs.com/liujiaxing-/p/18171978