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

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