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

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