Copyright: Tip of the Day Component Help


Tip of the Day Component: Overview

The Tip of the Day component adds “tip of the day” functionality to your application.

Once you’ve applied this component, every time your application is invoked it will display the Tip Of The Day dialog. The end user can turn off this feature by clearing the “Show Tips on Startup” check box on the dialog. The end user can also browse among the tips by clicking on the “Next Tip” button. The Tip of the Day dialog can also be invoked from your application’s Help menu.

Tip of the Day Component - Specifics

Tip of the Day Component - Results


Tip of the Day Component: Specifics

The Tip Of The Day dialog can be closed either by clicking the Close button or by pressing the ESC key. If the ESC key is pressed to dismiss the dialog box, any changes to the “Show Tips on Startup” check box are ignored.

The TIPS.TXT File

This feature utilizes the TIPS.TXT file in the current directory to display your tips. If you would like the tips file to have a different name or be located in a directory other than the current directory, modify the CTip constructor in the TIP.CPP file. (The class name CTip and the filename TIP.CPP are default names provided when you apply the component.)

The format of the tips file is as follows:

•	The file must be an ASCII text file with one tip per line.

•	A line starting with a semicolon is treated as a comment and is ignored. Comments must appear on their own line.

•	Blank lines are ignored.

•	Each tip can have up to 1000 characters.

•	A tip cannot begin with a space or a tab.

Tip Display Order

By default, tips are displayed in the order that they appear in the file. When all the tips have been shown once, then the sequence starts over. If the tips file is modified by the user, the order is reset to the beginning of the file. To provide this functionality, the application’s INI file is used to save the time stamp of the tips file (the TimeStamp key), the current position in the tip file (the FilePos key), and information regarding whether a tip has to be shown on startup (the StartUp key). A value of 0 for the StartUp key indicates that the tips are to be displayed on startup. Your application’s INI file is typically stored in the system directory.

Error Conditions

This component is intended for use with MFC applications. Your project should contain only one class derived from CWinApp; if there are multiple CWinApp-derived classes, the component will choose the first class for its implementation. These error conditions are indicated to the user through a message box.

You can create a log file recording the changes that the component makes to your project; the default name for this log file is RESULTS.LOG. If you select the Create Extensive Log option, you will be able to see details such as the actual code being added and the contents of new files.

The “Next Tip” button will be unavailable if the tips file is not found in the specified location. Other possible error conditions are if the file is not an ASCII text file or if it contains a syntax error. Such errors are visible only through testing. For example, if not all of the tips are displayed, you should examine your tips file at the location of the last tip displayed.

Adding “Tip Of The Day” to the Help Menu

This component modifies the OnInitMenu function of your frame window class to add a Tip Of The Day command to the Help menu. If the Help menu is not present (as in default AppWizard applications for Macintosh platforms), the function adds the Help menu. This causes a Help menu to appear only when a WM_INITMENU message is received. To avoid this behavior, you should add a Help menu to your application or remove the code from OnInitMenu.


Tip of the Day Component: Results

The Tip of the Day component makes the following changes to your project.

•	A class CTip implementing the “Tip of the Day” feature is added, implemented in the files TIPS.H and TIPS.CPP.

•	String and icon resources are added to your project.

•	The OnInitMenu member of your frame window class is modified to add a Tip of the Day command to the Help menu.


Tip of the Day Component: Main Page

Use this page to modify the default name of the class that will implement the “Tip of the Day” feature, and the name of the header and implementation files for that class.