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

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