Toolbars are usually used in SDI or MDI.
If we have built a toolbar in a Dialog, its prompt information may have no way.
The main reason is that we did not write a message mapping function for this toolbar.
If you want to increase. It can be like this.
1. Add a function of such a function to process
AFX_MSG BOOL ONTOOLTIPTEXT (UINT ID, NMHDR * PNMHDR, LRESULT * PRESULT);
BOOL MyDialog :: OnToolTipText (UINT id, NMHDR * pNMHDR, LRESULT * pResult) {ASSERT (pNMHDR-> code == TTN_NEEDTEXTA || pNMHDR-> code == TTN_NEEDTEXTW); // allow top level routing frame to handle the message if (GetRoutingFrame () = NULL!) return FALSE; // need to handle both ANSI and UNICODE versions of the message TOOLTIPTEXTA * pTTTA = (TOOLTIPTEXTA *) pNMHDR; TOOLTIPTEXTW * pTTTW = (TOOLTIPTEXTW *) pNMHDR; TCHAR szFullText [256]; CString strTipText; UINT_PTR nID = (UINT_PTR) pNMHDR-> idFrom; if (pNMHDR-> code == TTN_NEEDTEXTA && (pTTTA-> uFlags & TTF_IDISHWND) || pNMHDR-> code == TTN_NEEDTEXTW && (pTTTW-> uFlags & TTF_IDISHWND) ) {// idfrom is actually the hWnd of the tool nid = ((uint_ptr) :: getdlgctrlid ((hwnd) NID));} if (NID! = 0) // Will Be Zero on a separator {AFXLOADSTRING ((UINT) nID, szFullText); // this is the command id, not the button index AfxExtractSubString (strTipText, szFullText, 1, '/ n');} #ifndef _UNICODE if (pNMHDR-> code == TTN_NEEDTEXTA) lstrcpyn (PTTTA-> Sztext, STRTI PTEXT, (SIZEOF (PTTTA-> Sztext) / sizeof (PTTTA-> Sztext [0]))))))))))))))))))))))); else {int n = multibytetowideChar (cp_acp, 0, strtiptext, -1, ptttw-> sztext, sizeof (PTTTW-> Sztext) / sizeof (ptttw-> sztext [0])); if (n> 0) PTTTW-> sztext [n-1] = 0;} #else if (pnmHDR-> code == TTN_NeedTexta) {INT N = Widechartomultibyte (cp_acp, 0, strtiptext, -1, pttta-> sztext, sizeof (pttta-> sztext) / sizeof (PTTTA-> Sztext [0]), NULL, NULL); if (n> 0) PTTTA-> Sztext [N-1] = 0;} else lstrcpyn (PTTTW-> Sztext, Strtiptext, (SIZEOF (PTTTW-> Sztext) / sizeof (PTTTW-> Sztext [0]))))))))
#endif * pResult = 0; // bring the tooltip window above other popup windows :: SetWindowPos (pNMHDR-> hwndFrom, HWND_TOP, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE); return TRUE; // message was Handled} 2. Add a header file
#include
3. Create a message mapping
ON_NOTIFY_EX_RANGE (TTN_NEEDTEXTW, 0, 0xFFFF, ONTOOLTEXT) ON_NOTIFY_EX_RANGE (TTN_NeedTexta, 0, 0xFFFF, ONTOOLTEXT)
This should be okay.