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

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