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

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