在VB中,如何让msgbox 弹出的对话框不显示右上角的关闭按钮,就是那个叉叉?或者成不可用状态也可以。 15
语句是这样:msgboxchr(13)+"哈哈哈哈,你真好~",4096,"1"怎么修改呢?...
语句是这样:msgbox chr(13) + "哈哈哈哈,你真好~",4096,"1"
怎么修改呢? 展开
怎么修改呢? 展开
展开全部
加一个定时器控件
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
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
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
不行的,不然你就用窗口来代替
或者你获取msgbox的返回值,如果按下了关闭,再重新弹出
或者你获取msgbox的返回值,如果按下了关闭,再重新弹出
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
将msgbox改成form,当需要信息时,不用弹出对话框,直接显示另一个FORM窗口。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
自己新建一个窗口当msgbox 选择无边框窗口
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询