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

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