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

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