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

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