This method is applicable to the MFC derived class and passed the test in the dialog box-based class. The procedure is as follows:
1. Select the "project" menu and then "set active project ".
2. Select "project" menu --> "add to project" --> "components and controls" --> "VC ++ components" --> "tooltip support"
3. Select "insert"
4. Add a button to the resource in the dialog box. The ID is idc_tooltip.
5. Find the following comment line in cdialog: oninitdialog:
// Todo: Use one of the following forms to add controls:
// M_tooltip.addtool (getdlgitem (IDC _),);
// M_tooltip.addtool (getdlgitem (IDC _),"");
Then add a line of code after the comment line:
M_tooltip.addtool (getdlgitem (idc_tooltip), "Show tooltip ");
After the above steps:
The following code is automatically added to the header file (*. h:
Public:
Virtual bool pretranslatemessage (MSG * PMSG );
The implementation file (*. cpp) is added with the method implementation:
Pretranslatemessage (MSG * PMSG );
Compile the program and run it. Move the mouse pointer to the tooltip button to display a tooltip.