MessageBox in common use:
MessageBox("....");
输出字符" .....".
int result = MessageBox("Are you want to save context before Exit ?","AlertDialog",MB_ICONINFORMATION|MB_YESNOCANCEL);
MB_YESNOCANCEL 代表有三个按键,参数定义如下:
1 #define MB_OK 0x00000000L 2 #define MB_OKCANCEL 0x00000001L 3 #define MB_ABORTRETRYIGNORE 0x00000002L 4 #define MB_YESNOCANCEL 0x00000003L 5 #define MB_YESNO 0x00000004L 6 #define MB_RETRYCANCEL 0x00000005L
返回值参数定义如下:
1 /* 2 * Dialog Box Command IDs 3 */ 4 #define IDOK 1 5 #define IDCANCEL 2 6 #define IDABORT 3 7 #define IDRETRY 4 8 #define IDIGNORE 5 9 #define IDYES 6 10 #define IDNO 7
返回值的参数与用户选择的按键有关,例如 当按下 Yes键 返回值为 IDYES.
因此,这个可以用于当要执行某种操作时,提示用户做出选择。
end
thanks.