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

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