Data Access Worldwide Knowledge Base

Article ID 1999
Article Title HOWTO: Display a message just prior to leaving the program
Article URL http://www.dataaccess.com/kbasepublic/kbprint.asp?ArticleID=1999
KBase Category VDF (GENERAL)
Date Created 04/20/2004
Last Edit Date 04/26/2004


Article Text
QUESTION:
When the user exits my application I would like to bring a messagebox to the screen in which I tell them to make a backup frequently. What is the right place in the code where I can do this?

ANSWER:
Use the procedure Exit_Application at the desktop level and call the messagebox WinAPI function via the procedures info_box or stop_box.

Place the following code at the desktop object (above Start_Ui)

Procedure Exit_Application DESKTOP
    Boolean bExit
    
    Get Exit_System_Confirmation To bExit
    If (bExit) Begin
        Send Info_Box "Please frequently make backups of your data"
        Abort
    End
End_Procedure // Exit_Application

The augmented message will first try to execute a confirmation question in which the user can confirm the exit. If they choose YES to exit the application, the boolean variable bExit will be TRUE and the user will be informed to frequently make backups.

Because the default behavior of the exit_application method is to cancel the application, you need to place an ABORT statement in the procedure as shown above.



Contributed By:
Vincent Oorsprong
Company: Data Access Worldwide
email: vincent.oorsprong@dataaccess.eu
Web Site: http://www.dataaccess.eu


Email this Article
Email this Article to a Colleague
Send Feedback on this Article to Data Access Worldwide
Copyright ©2010 Data Access Corporation. All rights reserved.

The information provided in the Data Access Technical Knowledge Base is provided "as is" without warranty of any kind. Data Access Corporation disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. In no event shall Data Access Corporation or its suppliers be liable for any damages whatsoever including direct, indirect, incidental, consequential, loss of business profits or special damages, even if Data Access Corporation or its suppliers have been advised of the possibility of such damages. Some states do not allow the exclusion or limitation of liability for consequential or incidental damages so the foregoing limitation may not apply.