Desktop-as-a-Service Designed for Any Cloud ? Nutanix Frame

Download Source Code and Example

New VC++ look Tip of the day

Standard Component Gallery Tip of the Day dialog

Microsoft supplies a standard Component Gallery item called Tip of the day. IMHO this dialog is quite ugly, so I wrote another one which reproduces the look of the VC++ 4.0 Tip of the Day dialog. System color changes are handled correctly, that is the lightbulb is displayed correctly on the background (COLOR_BTNSHADOW). Therefore the lightbuld is stored in a resource bitmap and the outside of the bulb is filled with COLOR_BTNSHADOW prior to displaying.

There is another most useful feature: the Microsoft supplied Tip of the day class opens the Tip file in the current directory whereas my Tip of the Day class opens the dialog in the folder where the executable resides.

To integrate the new Tip of the day dialog into your application proceed as follows:

  • Use the Insert-Component command and insert the tip of the day component. This will add TipDlg.h and TipDlg.cpp to your project.
  • Edit stdafx.h and remove the #include <e:\MSDEV\Projects\Tip\TipDlg.h> or whatever line.
  • Replace the two automatically generated files  TipDlg.h and TipDlg.cpp with those supplied in the sample
  • Replace the IDD_TIP dialog with the one supplied in the sample.
  • That should be all.
The sample compiles with VC++ 4.0 and should also compile with more recent versions of MFC and or VC++.

Last updated: 17 July 1998


  • Error in OnNextTip()

    Posted by Legacy on 02/02/2003 08:00am

    Originally posted by: Ralf Sch�fer

    Real nice thing - thanks!

    Nevertheless there is a small problem: when you select/deselect the "Show tips on startup" checkbox and then press "Next tip", the changes are lost and the checkbox is re-initialized with the registry settings.

    Just add a line


    to the beginning of CTipDlg::OnNextTip(), this will save
    the modified state.


  • Error in constructor

    Posted by Legacy on 01/03/2003 08:00am

    Originally posted by: Andrew Truckle

    I noticed that the constructor uses the creation time of the file to check for alterations of the file.

    This is wrong. It should be the modification that is checked.

    So modify the st_ctime to st_mtime and the problem is resolved.

    You see, if you modify the same file, it will have the same creation time and thus will not return to file position 0, but checking the modified time will return to 0.

  • How to put a scroll bar

    Posted by Legacy on 04/02/2002 08:00am

    Originally posted by: Rita Shaw

    I am developing a similar application which would show Message of the Day.However my messages are very long to fit in the rectangle for which I need a vertical scroll to fit the text.
    How do i do that


  • Correction

    Posted by Legacy on 03/18/2002 08:00am

    Originally posted by: Anonymous

    If you try your sample program on Windows XP you'll see that the gray area containing the bitmap is too light. The reason is that you incorrectly paint it using COLOR_BTNSHADOW.

    If you want this dialog box to look like the one in Visual C++ 6.0, you need to use COLOR_APPWORKSPACE instead.

  • Addition to use newlines in the tip file

    Posted by Legacy on 09/28/2001 07:00am

    Originally posted by: James

    A really nice class you created here!

    To be able to display newlines in the tip dialog, add the following line at the end of the method
    void CTipDlg::GetNextTipString(CString& strNext):

    strNext.Replace("\\r\\n", "\r\n");

    This allows you to enter newlines in the tips.txt file as follows:

    Tip of the day line1\r\nLine2



  • New Tip Of The Day - You also need to include SplitPath.cpp/.h

    Posted by Legacy on 09/27/2000 07:00am

    Originally posted by: Craig Goldie

    Hey, just an addition to your steps for getting the new tip of the day dialog - you reference CSplitPath in the TipDlg.cpp and don't mention that people will have to include SplitPath.h/.cpp before it'll compile properly. Otherwise nicely done, it looks great now.

  • You must have javascript enabled in order to post comments.

Leave a Comment
  • Your email address will not be published. All fields are required.

Most Popular Programming Stories

More for Developers

RSS Feeds

Thanks for your registration, follow us on our social networks to keep up-to-date