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 (0)
There are no comments posted here yet

Find Articles by Tag

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