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

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