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

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