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

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