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

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