Tool tip

In my dialog based application for some components I would like to show the tooltip. I am doing this code.
In header file dlg.h
 CToolTpCtrl tooltip;
In cpp file dlg.cpp
  in the method           m_ToolTip.AddTool((CButton*)GetDlgItem(IDOK),"Open",NULL,0);
  in  OnMouseMove()
But tooltip is notvisible. Can you please help me out in this regardd??

Who is Participating?
wooperConnect With a Mentor Commented:
Your code is right bmuralimohan, you've just to add the following method in your class in order to able the ToolTip control to process its message:

In the header:

      BOOL PreTranslateMessage(MSG* pMsg);

in the implementation:

BOOL YOUCLASSHERE::PreTranslateMessage(MSG* pMsg)
      // Let the ToolTip process this message.
      return CDialog::PreTranslateMessage(pMsg); // used for a dialog based application.

Note: You can do all the tooltip's initialisation at the same time, so you don't have to use it into your OnMouseMove method.


      mytooltip.AddTool(GetDlgItem(IDOK), "This is a sample");

All Courses

From novice to tech pro — start learning today.