VBcoders Browse New Submit Contact Sign In

No account? Register free

Forgot password?

Auto close messagebox

Daniel Biener  (2 Submissions)   VB function enhancement   Visual Basic 3.0   Intermediate   Wed 3rd February 2021

This function replaces VB's msgbox function and closes itself after the parameter provided number of seconds. The syntax and return values are exactly the same as msgbox except the first parameter is the number of seconds to display. Just add this code to a module (not a cls or frm) in your project and call ACmsgbox. Thanks to Sparq's submission here for help in writing this.
with the added parameter of

API Declarations
Private Declare Function SetTimer Lib "user32" (ByVal hWnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long) As Long
Private Declare Function KillTimer Lib "user32" (ByVal hWnd As Long, ByVal nIDEvent As Long) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function SetForegroundWindow Lib "user32" (ByVal hWnd As Long) As Long
Private Const NV_CLOSEMSGBOX As Long = &H5000&
Private sLastTitle As String

Rate Auto close messagebox (4(4 Vote))
Auto close messagebox.bas

Auto close messagebox Comments

No comments yet — be the first to post one!

Post a Comment

0/1000 characters