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

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