关于win32 application中,MessageBox使用的疑问

2025-04-26 20:36:55
推荐回答(1个)
回答1:

MB_YESNO 代表 messagebox 将显示 yes no (是,否)两个按钮
messagebox的返回值 如果是IDYES,则说明用户点击的是 “是”

用findstr命令查一下头文件
#define MB_YESNO 0x00000004L
微软定义的宏常量 MB_YESNO 的值为 0x00000004L
#define IDYES 6
微软定义的宏常量 IDYES 的值为 6

Microsoft Windows XP [版本 5.1.2600]
(C) 版权所有 1985-2001 Microsoft Corp.
C:\Documents and Settings\veket\桌面>cd "C:\Program Files\Microsoft Visu
al Studio\VC98\Include"
C:\Program Files\Microsoft Visual Studio\VC98\Include>findstr /n /s "MB_YES" *.h
MSIQUERY.H:152:// MB_OK,MB_OKCANCEL,MB_ABORTRETRYIGNORE,MB_YESNOCANCEL,MB_YESNO,
MB_RETRYCANCEL
WINUSER.H:6073:#define MB_YESNOCANCEL 0x00000003L
WINUSER.H:6074:#define MB_YESNO 0x00000004L
C:\Program Files\Microsoft Visual Studio\VC98\Include>findstr /n /s "IDYES" *.h
MSIQUERY.H:682:// Returns Win32 button codes: IDOK IDCANCEL IDABORT IDRETRY IDIG
NORE IDYES IDNO
SHLOBJ.H:1251:// IDYES - means allow the operation
SHLOBJ.H:3485:// IDYES - The user has selected Update Now/About Update. Th
e caller should navigate to
WINUSER.H:7542:#define IDYES 6
C:\Program Files\Microsoft Visual Studio\VC98\Include>

..............例举部分 MB_打头的宏

WINUSER.H:6070:#define MB_OK 0x00000000L
WINUSER.H:6071:#define MB_OKCANCEL 0x00000001L
WINUSER.H:6072:#define MB_ABORTRETRYIGNORE 0x00000002L
WINUSER.H:6073:#define MB_YESNOCANCEL 0x00000003L
WINUSER.H:6074:#define MB_YESNO 0x00000004L
WINUSER.H:6075:#define MB_RETRYCANCEL 0x00000005L
WINUSER.H:6078:#define MB_ICONHAND 0x00000010L
WINUSER.H:6079:#define MB_ICONQUESTION 0x00000020L
WINUSER.H:6080:#define MB_ICONEXCLAMATION 0x00000030L
WINUSER.H:6081:#define MB_ICONASTERISK 0x00000040L
WINUSER.H:6084:#define MB_USERICON 0x00000080L
WINUSER.H:6085:#define MB_ICONWARNING MB_ICONEXCLAMATION
WINUSER.H:6086:#define MB_ICONERROR MB_ICONHAND
WINUSER.H:6089:#define MB_ICONINFORMATION MB_ICONASTERISK
WINUSER.H:6090:#define MB_ICONSTOP MB_ICONHAND
........................

..............例举部分 ID 打头的宏........
WINUSER.H:7537:#define IDOK 1
WINUSER.H:7538:#define IDCANCEL 2
WINUSER.H:7539:#define IDABORT 3
WINUSER.H:7540:#define IDRETRY 4
WINUSER.H:7541:#define IDIGNORE 5
WINUSER.H:7542:#define IDYES 6
WINUSER.H:7543:#define IDNO 7
....................