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

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