...弹出的对话框不显示右上角的关闭按钮,就是那个叉叉?或者成不可用...
发布网友
发布时间:2024-03-16 15:29
我来回答
共4个回答
热心网友
时间:2024-03-21 05:05
自己新建一个窗口当msgbox 选择无边框窗口
热心网友
时间:2024-03-21 05:06
加一个定时器控件
Private Declare Function GetSystemMenu Lib "user32" (ByVal hwnd As Long, ByVal bRevert As Long) As Long
Private Declare Function RemoveMenu Lib "user32" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long) As Long
Private Declare Function DrawMenuBar Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function GetMenuItemCount Lib "user32" (ByVal hMenu As Long) As Long
Private Const MF_BYPOSITION = &H400&
Private Const MF_DISABLED = &H2&
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
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 Const MB_OK = &H0&
Dim MsgTitle As String
Private Sub Command1_Click()
MsgTitle = "你真好"
Timer1.Enabled = True: Timer1.Interval = 1
MessageBox Me.hwnd, "哈哈哈哈,你真好~", MsgTitle, MB_OK
End Sub
Private Sub Timer1_Timer()
h = FindWindow(vbNullString, MsgTitle)
If h > 0 Then Call DisableX(h): Timer1.Enabled = False
End Sub
Private Sub DisableX(ByVal hwnd As Long)
Dim hMenu As Long, nCount As Long
hMenu = GetSystemMenu(hwnd, 0)
nCount = GetMenuItemCount(hMenu)
Call RemoveMenu(hMenu, nCount - 1, MF_DISABLED Or MF_BYPOSITION)
DrawMenuBar hwnd
End Sub
热心网友
时间:2024-03-21 05:03
不行的,不然你就用窗口来代替
或者你获取msgbox的返回值,如果按下了关闭,再重新弹出
热心网友
时间:2024-03-21 05:03
将msgbox改成form,当需要信息时,不用弹出对话框,直接显示另一个FORM窗口。