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

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