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

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