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

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