msgBox(正式にはmessageBox)のパラメータの使用例です。組み合わせはいろいろ考えられますがよく使うのは以下の5パターンでしょう。
| 16 |
 |
|
| 35 |
 |
|
| 36 |
 |
|
| 48 |
 |
|
| 64 |
 |
|
msgBoxに表示されるボタンのメッセージ(またはアイコン)は以下のパラメータの組み合わせになります。
例えば、MB_YESNO(4)とMB_ICONQUESTION(32)との組み合わせはその合計の36となります。ただし、ボタンの名前同士(0〜6)、アイコン同士(16〜64)の組み合わせはできません。
【msgBoxパラメータ一覧】
|
値 |
定数 |
ボタンの名前(アイコン) |
| ボタン |
0 |
MB_OK |
[OK] |
| 1 |
MB_OKCANCEL |
[OK][キャンセル] |
| 2 |
MB_ABORTRETRYIGNORE |
[中止][再試行][無視] |
| 3 |
MB_YESNOCANCEL |
[はい][いいえ][キャンセル] |
| 4 |
MB_YESNO |
[はい][いいえ] |
| 5 |
MB_RETRYCANCEL |
[再試行][キャンセル] |
| アイコン |
16 |
MB_ICONSTOP |
(×) 赤 |
| 32 |
MB_ICONQUESTION |
(?) 白 |
| 48 |
MB_ICONEXCLAMATION |
(!) 黄色 |
| 64 |
MB_ICONINFORMATION |
(!) 白 |
以下はmsgBoxを関数として使用した場合の戻り値です。
【msgBoxの戻り値】
| 値 |
ボタン |
定数 |
| 1 |
[OK] |
IDOK |
| 2 |
[キャンセル] |
IDCANCEL |
| 3 |
[中止] |
IDABORT |
| 4 |
[再試行] |
IDRETRY |
| 5 |
[無視] |
IDIGNORE |
| 6 |
[はい] |
IDYES |
| 7 |
[いいえ] |
IDNO |
なお、定数を使用する場合は以下の宣言が必要になります。
%include "lsconst.lss"
参考までに"lsconst.lss"の中の関連部分を掲載しておきます。
'-----------------------------------------------------------------------------
' MsgBox parameters
'-----------------------------------------------------------------------------
Public Const MB_OK = 0 ' OK button only
Public Const MB_OKCANCEL = 1 ' OK and Cancel buttons
Public Const MB_ABORTRETRYIGNORE = 2 ' Abort, Retry, and Ignore buttons
Public Const MB_YESNOCANCEL = 3 ' Yes, No, and Cancel buttons
Public Const MB_YESNO = 4 ' Yes and No buttons
Public Const MB_RETRYCANCEL = 5 ' Retry and Cancel buttons
Public Const MB_ICONSTOP = 16 ' Critical message
Public Const MB_ICONQUESTION = 32 ' Warning query
Public Const MB_ICONEXCLAMATION = 48 ' Warning message
Public Const MB_ICONINFORMATION = 64 ' Information message
Public Const MB_APPLMODAL = 0 ' Application Modal Message Box
Public Const MB_DEFBUTTON1 = 0 ' First button is default
Public Const MB_DEFBUTTON2 = 256 ' Second button is default
Public Const MB_DEFBUTTON3 = 512 ' Third button is default
Public Const MB_SYSTEMMODAL = 4096 ' System Modal
'-----------------------------------------------------------------------------
' MsgBox return values
'-----------------------------------------------------------------------------
Public Const IDOK = 1 ' OK button pressed
Public Const IDCANCEL = 2 ' Cancel button pressed
Public Const IDABORT = 3 ' Abort button pressed
Public Const IDRETRY = 4 ' Retry button pressed
Public Const IDIGNORE = 5 ' Ignore button pressed
Public Const IDYES = 6 ' Yes button pressed
Public Const IDNO = 7 ' No button pressed
|
|