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

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