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

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