Tech Articles


How to make a MessageBox automatically timeout


I was wondering if it was possible to have a MessageBox that could automatically close after a set period of time so I did some searching and found that you can!

 

In Windows XP, Microsoft added a function MessageBoxTimeout but didn’t document it. The normal MessageBox function was changed to call MessageBoxTimeout passing the maximum value for the timeout. The maximum timeout value equates to about 49 days.

 

I developed a code example that uses the MessageBoxTimeout function. The function arguments/returns are patterned after the built in MessageBox function. My code translates the Icon and Button arguments to the values the API function expects.

 

The following is an example of using the function:

 

n_msgbox ln_msgbox

Integer li_rc

 

li_rc = ln_msgbox.of_MessageBoxTimeout(“MessageBoxTimeout”, &

                                “Message will timeout in 3 seconds!”, Exclamation!, OK!, 3)

 

I also coded the API function MessageBeep. The MessageBeep function plays the sound associated with an Icon (Exclamation!, Stop!, Information!).

 

You can download the code example from my website:

 

Topwiz Software – MessageBox

Comments (1)
Thursday, Feb 27 2025

Nice info

0

Find Articles by Tag

Error Design Data TortoiseGit Import JSON Outlook Windows OS Web Service Proxy 64-bit SQL Linux OS Database Profile ActiveX PBVM Git Web API JSON JSONParser Configuration Event Handler CrypterObject Android Service Deployment Debugging Trial Import PFC Export DataType Encryption Database Object Automated Testing DragDrop iOS Database Table Schema Database Connection Sort PowerBuilder (Appeon) Mobile PostgreSQL ODBC driver Icon DLL GhostScript Source Control Testing Event Handling REST TLS/SSL PowerServer Web PDFlib Filter Visual Studio PowerScript (PS) UI Themes Text OrcaScript PowerBuilder MessageBox UI Export JSON PBNI Graph 32-bit Stored Procedure Application TFS License OAuth 2.0 Variable Migration SnapDevelop Debug SqlExecutor SqlModelMapper Syntax IDE PostgreSQL HTTPClient Menu Platform OLE XML Installation PBDOM Azure PowerBuilder Compiler .NET DataStore Branch & Merge C# InfoMaker DataWindow JSON Database Table Data SDK Elevate Conference Performance Array RibbonBar TreeView Interface RichTextEdit Control NativePDF .NET Assembly WinAPI Database Painter Window Transaction JSONGenerator COM Event DataWindow Repository Messagging BLOB SOAP UI Modernization Class RibbonBar Builder SQL Server Database Table CoderObject Database RESTClient Excel SnapObjects WebBrowser Authentication Jenkins Windows 10 Icons OAuth DevOps API Script File ODBC Bug External Functions CI/CD Expression Oracle Charts Encoding Debugger PowerServer Mobile Model Authorization Validation SVN .NET Std Framework PDF Open Source Resize Source Code