Little experience regarding Timed Close Inquiry dialog

zhaozj2021-02-16  49

Friends who have used Rising anti-virus software know that he can close the inquiry dialog. The implementation of the interrogation dialog is very simple, and the msgbox provided in VB can be implemented, but the problem is to ask the dialog box is the pattern dialog. If it does not turn off it, the following code cannot continue, this is more than a few more They have caused some trap. So how to solve it, my solution is to call the API function messagebox instead of Msgbox, combined with the Timer control to automatically turn off, gossip, see the code, the following code demonstrates how to close the dialog after 10 seconds (a button on the form , A Timer Control):

Option expedition

Const MB_DEFBUTTON1 = & H0 & Const MB_DEFBUTTON2 = & H100 & Const MB_DEFBUTTON3 = & H200 & Const MB_ICONASTERISK = & H40 & Const MB_ICONEXCLAMATION = & H30 & Const MB_ICONHAND = & H10 & Const MB_ICONINFORMATION = MB_ICONASTERISKConst MB_ICONQUESTION = & H20 & Const MB_ICONSTOP = MB_ICONHANDConst MB_OK = & H0 & Const MB_OKCANCEL = & H1 & Const MB_YESNO = & H4 & Const MB_YESNOCANCEL = & H3 & Const MB_ABORTRETRYIGNORE = & H2 & Const MB_RETRYCANCEL = & H5 & 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 LongPrivate Declare Function FindWindow Lib "user32" Alias ​​"FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As LongPrivate Declare Function GetDlgItem Lib "user32" (ByVal hDlg As Long, ByVal nIDDlgItem As Long) As LongPrivate Declare Function SendMessage Lib "user32" Alias ​​"SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long , lParam as any) As longprivate const bm_ CLICK = & HF5Dim i As LongPrivate Sub Command1_Click () Timer1.Enabled = True MessageBox Me.hwnd, "this is test", App.Title, MB_OK Timer1.Enabled = FalseEnd SubPrivate Sub Form_Load () Timer1.Enabled = False Timer1.Interval = 1000und SUB

Private sub timer1_timer ()

转载请注明原文地址:https://www.9cbs.com/read-23161.html

New Post(0)