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

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