给对话框ToolBar加ToolTip
来源:互联网 发布:sql数据库编辑工具 编辑:程序博客网 时间:2024/05/20 22:39
1,.h
afx_msg BOOL Ontooltiptext(UINT, NMHDR* pnmhdr, LRESULT* presult);
2,.cpp
ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTW, 0, 0xffff, Ontooltiptext)
ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTA, 0, 0xffff, Ontooltiptext)
3,
BOOL CXXXDlg::Ontooltiptext(UINT, NMHDR* pnmhdr, LRESULT* presult)
{
int AFXAPI AfxLoadString(UINT nIDS, LPTSTR lpszBuf, UINT nMaxBuf = 256);
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 csttiptext;
CString cststatustext;
UINT nid = 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)(WORD)::GetDlgCtrlID((HWND)nid));
}
if (nid != 0) // will be zero on a separator
{
AfxLoadString(nid, szfulltext);
// this is the command id, not the button index
AfxExtractSubString(csttiptext, szfulltext, 1, '/n');
AfxExtractSubString(cststatustext, szfulltext, 0, '/n');
}
// non-unicode strings only are shown in the tooltip window...
if (pnmhdr->code == TTN_NEEDTEXTA)
lstrcpyn(pttta->szText, csttiptext,
(sizeof(pttta->szText)/sizeof(pttta->szText[0])));
else
_mbstowcsz(ptttw->szText, csttiptext,
(sizeof(ptttw->szText)/sizeof(ptttw->szText[0])));
*presult = 0;
// bring the tooltip window above other popup windows
::SetWindowPos(pnmhdr->hwndFrom, HWND_TOP, 0, 0, 0, 0,
SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOSIZE);
return TRUE; // message was handled
}
- 给对话框ToolBar加ToolTip
- 给对话框加状态栏
- 给对话框加状态栏
- 给MFC对话框加背景图
- 用div模仿tooltip给gridview加行内容预览
- VC中如何给对话框加背景图片
- 给按钮加确认对话框事件
- 控件加tooltip
- 【.net】给DataGrid的删除加确认对话框
- toolbar自绘按钮如何实现tooltip
- 在视图上加ToolTip
- easyui tree 加tooltip提示
- toolbar item 加图片
- ext给grid加toolTip提示(转自http://blog.sina.com.cn/s/blog_5a5d07e60100n7l3.html)
- 在对话框中添加TOOLBAR
- mfc toolbar对话框的总结
- ToolBar的Button上使用ToolTip的方法(SDK)
- ToolBar的Button上使用ToolTip的方法(SDK)
- 进制转换续
- 急,十万火急!!在girdview中PagerTemplate内容不显示
- 获取系统当前时间
- 两种安装XP系统的方法
- 获取主机名,IP
- 给对话框ToolBar加ToolTip
- SetToolTip
- SetFont
- 创建文件夹
- 考研节约时间20法
- 获取当前应用程序路径
- 创建工具条
- CStatusBar
- 显示隐藏工具栏