面试题答案
一键面试以下是实现代码:
Private Declare Function MessageBox Lib "user32" Alias "MessageBoxA" (ByVal hwnd As Long, ByVal lpText As String, ByVal lpCaption As String, ByVal wType As Long) As Long
Private Sub Command1_Click()
Dim result As Long
result = MessageBox(0, "这是一个测试提示", "提示", 0)
End Sub
参数解释:
hwnd
:指定拥有此消息框的窗口句柄。如果设为0,表示此消息框不属于任何窗口,这里设为0表示没有父窗口。lpText
:消息框中显示的文本内容,这里为“这是一个测试提示”。lpCaption
:消息框的标题,这里为“提示”。wType
:指定消息框中显示的按钮和图标等样式。设为0表示只显示“确定”按钮 。