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

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