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

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