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

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