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

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