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

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