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

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