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

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