Tooltips for dialog controls

Here's a little trick I use to get tooltips into a dialog quickly. I usually put this code into the OnInitDialog. It allows me to easily add tooltips to any dialog quickly.

Add a member to the CDialog or CWnd derived class in the header like:
CToolTipCtrl    CTTDialog :: m_ToolTip;
In the OnInitDialog or OnInitialUpdate, add:
m_ToolTip.Create (this);
m_ToolTip.Activate (TRUE);

CWnd*    pWnd = GetWindow (GW_CHILD);
while (pWnd)
{
    int nID = pWnd->GetDlgCtrlID ();
    if (nID != -1)
    {
        m_ToolTip.AddTool (pWnd, pWnd->GetDlgCtrlID ());
    }
    pWnd = pWnd->GetWindow (GW_HWNDNEXT);
}
To add a tooltip to a control, just add a string resource using the same ID as the control to get the tip. If I wanted the OK button to have a tip, I would add a string resource for IDOK.

Also do not forget to put the following code to you dialog class:
BOOL CTTDialog :: PreTranslateMessage(MSG* pMsg) 
{
    if (m_hWnd)
    {
        m_ToolTip.RelayEvent (pMsg);
        return CDialog::PreTranslateMessage(pMsg);
    }
    return (FALSE);
}
That's it.

Last updated: 18 May 1998



Comments

  • Beats past Dr Dre, your elect

    Posted by motherdhmm on 06/04/2013 09:08pm

    [url=http://www.headphonescheaponlineaustralia.com/dre-beats-studio-c-66_68_71.html]beats studio[/url] Beats by Dre Studio are precision-engineered to let slip the full quality of today¡¯s digital music including the most sonically insistent astonish, cool short trip and R&B. With advanced speaker lay out, powered amplification, and busy alarms canceling, Beats by Dre Australia delivers all the power, clarity, and intense bass today¡¯s meridian artists and producers hunger for you to hear. This Monster Beats can bring on you the new adventure, nab it, don¡¯t let it off away from your hands. [url=http://www.headphonescheaponlineaustralia.com/]beats by dre Australia[/url] You may also like this Missing link Turbine Earphones, In the service of the pubescent users, hipop fans and NBA fans, the outside looks is also of the standards recompense a Mutation Beats Dr Dre, and even a necessary standard. As a new emerging troops in headphone industry, Eyesore products melody counterpart stress on both publication and acoustic. It is not a unusual mania to agree to bear that Monster Beats Studiobecomes the favourite determination repayment for lots of stars. [url=http://blog.cheapbeatsbydre.co.nz/]beats by dre nz[/url] Where is the grace of spell resemble headphones? Monster headphones is why many of my friends loved, why the Giant is the be featured of the wink of an eye spectacle headphones? Hype, publicity, or what? Want to grasp that the Nightmarishness would like to know the eyesore headphones of it with me to get it the next. The most noted Brute headphones stylishness is not vested with the brute recording engineer, not a helpful simple to impel Monster Solo HD and people attend to the handle can be linked to look like mutant of noodles. Speaking of the mutant of noodles would like to from him a drawing of people indeed, giant noodles in a repeatedly sold manifest of this why? This is because the magic of the elegance of the echo, the demonolatry investigate of noodles series headphones, Horror Beats Justbeats Unaccompanied HD Purple on-ear headphones, names such as physical, headphone line, not in any degree intertwined friends present to avail oneself of headphones to clear a irritating problem. Is the just right focus, the headset intrinsic. Slight headphones can genuinely around a significant effect. The rave reviews of this headset, I swear by the-ear headphones is not a can and comparable to the spell sound of noodles no implication the shape, or internal. The blink is the incline update of fast-paced society. I in that the trice the missing link is also in the supplementary products, trends and resemble combination. This is the charm of monster.

    Reply
  • Beats by dre primært Er synes er meget godt rimelige

    Posted by wanzixiao on 06/04/2013 11:28am

    [url=http://www.kbhretelefonerbillig.webstarts.com/]beats høretelefoner[/url] i hvert fald set er en god musik altid være påkrævet, og hovedtelefonerne som Dre beats forbedrer sådan musik, så du har lyst til himlen. I denne artikel vil vi diskutere, hvor langt disse bemærkelsesværdige hovedtelefoner (Dre beats hovedtelefoner) er i stand til, og hvordan strålende det kan støtte dig til at få essensen af musikken. For din korte viden – Monster har formået at kombinere stil med funktionalitet i Dr. Dre udvalg af hovedtelefoner understøtter disse ikke blot at se godt, men også at gøre lydkvaliteten endnu bedre. Hvis du kigger ind i dens specifikationer så du kan indse det, at de beats fra Dre hovedtelefoner lyd er altid velafbalanceret med en varm mellemtone og dunkende bas. [url=http://www.beatsbydrehretelefoner.weebly.com/]Beats by dre billig pris[/url] DRE beat, begrebet glatte jazz, klassiske elementer blandet rock, elektronisk musik, skaber fantastiske beats by dre unik lyd. Den rytmen omdefinere personlig lydoplevelse, skabt af musikere headset. Shooting hver eneste tone, aldrig hver eneste nuance i hørt før realisme og iøjnefaldende design ørepropper trompet mundstykke, som en passende vidne føreren af fartøjet. Det er ikke kun de bedste hovedtelefoner til jazz. Uanset om du lytter, vil rytmen være et nyt højdepunkt for al din musik. [url=http://www.beatsbydrdredanmark.weebly.com/]Beats by dre danmark[/url] On classical tracks, like John Adams’ “The Chairman Dances,” high-register strings, brass, and percussion take center stage. At times, the Zoro can sound perhaps too bright, but it’s never overly harsh or unpleasant. The lower-register strings and percussion receive less embellishment than they do with many modern pairs (like the Beats) that tend to overemphasize the bass. Here, there is more overall balance, a bass presence that sits nicely in the mix, and a focus on the mids and highs.

    Reply
  • You want some tomato basil and mozzarella. In esteem of indoor say, these slippers are as light and manueverable as sneakers.

    Posted by Soaceddew on 04/24/2013 08:57am

    Has only released some chic color Democratic Inneva Woven shoes, Nike recently with another way to regurgitate shoes with distinguishable styling to all [url=http://northernroofing.co.uk/roofins.cfm]nike free run[/url] eyes. This brings steadfast issue Free Inneva Woven is a White Label of works in the series, represents shoes Italian made the assurance. Latest Liberated Inneva Woven jet and pornographic are available in two color schemes, to hand-knit Woven vamp in summing-up to infiltrated Italy's [url=http://fossilsdirect.co.uk/glossarey.cfm]nike huarache free[/url] finest crafts, during the interval gives athletes close to the foot of relieve, the most important opportunity is the goal of Loose 5 configuration, barefoot be aware it resolution allure cannot be ignored. Nike Disburden Inneva Woven SP White Label Wedge on Parade 16 at outlets for everyone the [url=http://northernroofing.co.uk/roofins.cfm]nike free uk[/url] trade name on the shelves, and on sale in narrow sort, interested friends should recompense close publicity to Nike announced the news.

    Reply
  • NikeFree again four shoes eager in autumn and winter wear assuage is perfect ok champion

    Posted by Speadyday on 04/19/2013 08:33am

    Nike Unengaged TR Becoming 2 Safeguard upper of textile materials in line with seasonal requirements, enhances the warmth and durability, and cogitative material, in [url=http://www.nikeskorrea.se/nike-air-max-1-c-41/]air max 1[/url] poor visibility when elucidation and DWR (fast water unruly) coating to achieve breathability while, contract out feet barren in dripping weather. Shoe northern welt on the preferential of the bow down foam enhances foot support and stability. Quality ratio of the Nike Free shoe Groove lay out provides stretchable like literal feet be aware and stability of multi-direction workings while [url=http://www.nikeskoroutlet.se/nike-free-run-2-c-61/]nike free run 2 dam[/url] retaining tenure and shockproof column inherent in training shoes. Lightweight Phylite midsole can unseat and plenty of durability, which increments the utility exponentially outsole, which significantly reduces the manipulate of the shoe. Tail and foot rubber grooves made of environmentally clubby materials, stop to lift its [url=http://www.nikeskoroutlet.se/nike-free-30-v4-c-85/]nike free 3.0 sverige[/url] multi-directional feel on all kinds of route surfaces.

    Reply
  • ComboBoxEx

    Posted by Legacy on 11/02/2003 12:00am

    Originally posted by: Walter Hahn

    This method works perfect but not with the ComboBoxEx control. Any idea how to get it work with this control?

    Reply
  • Cant get this to work in Visual C++.NET (7.0)

    Posted by Legacy on 10/28/2003 12:00am

    Originally posted by: Mike Pliam

    I can't get this to work using C++ 7.0.  I've even tried Corey's fix and putting 'EnableToolTips(TRUE);' in the OnInitDialog() member.
    
    

    Any other's had this problem or know how to fix it?

    Mike

    Reply
  • How to get "&" in ToolTips.

    Posted by Legacy on 11/27/2002 12:00am

    Originally posted by: Rajkumar

    All are fine..But how to get ampersand in tooltips.

    Reply
  • Tooltip useful

    Posted by Legacy on 04/09/2002 12:00am

    Originally posted by: Anand Kumar


    best is yet to be seen

    thanks

    Reply
  • Thanks a lot! I like it!

    Posted by Legacy on 01/30/2002 12:00am

    Originally posted by: GZM

    Your method is very simple!
    
    And she is very useful!
    Thank you!

    Reply
  • tooltips in CstatusBarCtrl ???

    Posted by Legacy on 06/02/2001 12:00am

    Originally posted by: amit gupta

    How can i use the tooltips when i use a CStatusBarCtrl status bar .how should i trap the event when the mouse hovers over a button or a menu item.Problem is that i am unable to use CStatusBar with dialogs.Hence i am using CStatusBarCtrl .

    Can anybody suggest how to use a status bar in a dialog
    Please.I am ready to try anything.
    Waiting...

    Reply
  • Loading, Please Wait ...

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

Top White Papers and Webcasts

  • Live Event Date: May 6, 2014 @ 1:00 p.m. ET / 10:00 a.m. PT While you likely have very good reasons for remaining on WinXP after end of support -- an estimated 20-30% of worldwide devices still are -- the bottom line is your security risk is now significant. In the absence of security patches, attackers will certainly turn their attention to this new opportunity. Join Lumension Vice President Paul Zimski in this one-hour webcast to discuss risk and, more importantly, 5 pragmatic risk mitigation techniques …

  • The exponential growth of data, along with virtualization, is bringing a disruptive level of complexity to your IT infrastructure. Having multiple point solutions for data protection is not the answer, as it adds to the chaos and impedes on your ability to deliver consistent SLAs. Read this white paper to learn how a more holistic view of the infrastructure can help you to unify the data protection schemas by properly evaluating your business needs in order to gain a thorough understanding of the applications …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds