Extended ToolTipCtrl (from IE4)

Download Source Code


The CToolTipEx class is a extension of the MFC CToolTipCtrl control. When Microsoft c reated Internet Explorer 4, they also added many new functions and capabilities for CToolTipCtrl. Unfortunately, they have not added these to the CToolTipCtrl class yet. This class wraps all the new procedures in an easy to use and recognizable format.

Some of the new functions included:

  • Ability to change the colors of both the background and foreground (text) of the Tooltip.
  • Ability to change the margins (empty space) surrounding the Tooltip.
  • Extended the SetDelayTime function to allow for changing the amount of time the Tooltip is visible and changing the amount of time before the Tooltip appears when moving the cursor to a new control.
  • Ability to adjust the maximum width of the Tooltip. Anything bigger will be displayed on multiple lines.
  • Ability for the Tooltip to move (track) with the cursor.

Note: To use this class you must have the most current Common Controls DLL (the one that came with IE4 is fine) and the new Common Controls header file (this can be found at http://premium.microsoft.com/msdn/library/sdkdoc/c622_7nzn.htm).

General usage:

In your mainfrm.h add a variable for the tooltip:

	CToolTipEx MyToolTip;

In your mainfrm.cpp's OnCreate, after you create the ToolBar:

	m_wndToolBar.GetToolBarCtrl().SetToolTips(&MyToolTip);

To access your tooltip control you must use:

	_AFX_THREAD_STATE* pThreadState = AfxGetThreadState();
	CToolTipEx* pToolTip = (CToolTipEx*) pThreadState->m_pToolTip;

The reason you must use the above two lines instead of CToolBarCtrl's GetToolTips() is that the Toolbar doesn't really own the tooltip. It is owned by the main application thread.

If you have any questions see the provided help file. It lists all the functions and gives examples for each.

Last updated: 9 May 1998



Comments

  • *.hlp: Nice piece of MSDN!

    Posted by Legacy on 07/09/1999 12:00am

    Originally posted by: William Gates

    Redundant help rulez!

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

Top White Papers and Webcasts

  • Live Event Date: October 29, 2014 @ 11:00 a.m. ET / 8:00 a.m. PT Are you interested in building a cognitive application using the power of IBM Watson? Need a platform that provides speed and ease for rapidly deploying this application? Join Chris Madison, Watson Solution Architect, as he walks through the process of building a Watson powered application on IBM Bluemix. Chris will talk about the new Watson Services just released on IBM bluemix, but more importantly he will do a step by step cognitive …

  • Live Event Date: October 23, 2014 @ 12:00 p.m. ET / 9:00 a.m. PT Despite the current "virtualize everything" mentality, there are advantages to utilizing physical hardware for certain tasks. This is especially true for backups. In many cases, it is clearly in an organization's best interest to make use of physical, purpose-built backup appliances rather than relying on virtual backup software (VBA - Virtual Backup Appliances). Join us for this eSeminar to learn why physical appliances are preferable to …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds