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

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