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

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