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 (0)
There are no comments posted here yet

Find Articles by Tag

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