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

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