Add tooltip to a CStatic

Jason picture Jason · Nov 13, 2012 · Viewed 7.5k times · Source

I haven't been able to find a concise chunk of code that allows me to add/display tooltips to a CStatic (and CLed) control. Obviously, the standard code to do so does not apply for this type of control. Can someone post code snippets?

Answer

user3148898 picture user3148898 · Jan 16, 2014

I hope this code will solve your problem .One important thing make NOTIFY property of CStatic =TRUE.

if( !m_ToolTip.Create(this))
{
    TRACE0("Unable to create the ToolTip!");
}
else
{
    CWnd* pWnd = GetDlgItem(IDC_STATIC_MASTER_PWD);
    m_ToolTip.AddTool(pWnd,"Ok");
    m_ToolTip.Activate(TRUE);
}

Let me know if any problem.