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

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