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

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