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

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