Displaying a Message Box

Demonstration Program
We will demonstrate a short program that demonstrates some capabilities of the MessageBoxA
function. The first function call displays a warning message:

Program Listing
Following is a complete listing of a MessageBox demonstration program. The function named
MessageBox is an alias for the MessageBoxA function, so we will use the simpler name:

TITLE Demonstrate MessageBoxA (MessageBox.asm)
INCLUDE Irvine32.inc
.data
captionW BYTE "Warning",0
warningMsg BYTE "The current operation may take years "
BYTE "to complete.",0

captionQ BYTE "Question",0
questionMsg BYTE "A matching user account was not found."
BYTE 0dh,0ah,"Do you wish to continue?",0
captionC BYTE "Information",0
infoMsg BYTE "Select Yes to save a backup file "
BYTE "before continuing,",0dh,0ah
BYTE "or click Cancel to stop the operation",0
captionH BYTE "Cannot View User List",0
haltMsg BYTE "This operation not supported by your "
BYTE "user account.",0
.code
main PROC
; Display Exclamation icon with OK button
INVOKE MessageBox, NULL, ADDR warningMsg,
ADDR captionW,
MB_OK + MB_ICONEXCLAMATION
; Display Question icon with Yes/No buttons
INVOKE MessageBox, NULL, ADDR questionMsg,
ADDR captionQ, MB_YESNO + MB_ICONQUESTION
; interpret the button clicked by the user
cmp eax,IDYES ; YES button clicked?
; Display Information icon with Yes/No/Cancel buttons
INVOKE MessageBox, NULL, ADDR infoMsg,
ADDR captionC, MB_YESNOCANCEL + MB_ICONINFORMATION \
+ MB_DEFBUTTON2
; Display stop icon with OK button
INVOKE MessageBox, NULL, ADDR haltMsg,
ADDR captionH,
MB_OK + MB_ICONSTOP
exit
main ENDP
END main

 

转载于:https://www.cnblogs.com/dreamafar/p/5978558.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值