如何在OnMouseMove事件中出现一个Tooltips,就像金山词霸取词效果 ?现在我已经添加了OnMouseMove事件处理函数了。
解决方案 »
- 怎么自绘对话框上三色圆圈动画旋转
- 关于GetPrivateProfileInt的使用问题。急求。。
- 制作串口通讯Activex,遇到的问题?
- 一个简单的OnLButtonDown的问题,在线等!!!
- 不用VC向导,我想继承CWinApp基类,怎样才能在ClassWizard中看见呢?
- 哪位老兄知道哪有好的计算机研究所?
- 有没有开发IE插件的SDK?
- 急,关于socket异常中断问题?
- 跪求BHO关于自定义浏览器上下文菜单的源码
- WEBBROWSER如何确定网页跳转
- 为什么这个例子在退出的时候触发Send按钮,找了半天快疯了!!!!!!!!!!!!!!!!!!!!!!
- UTF8格式的网页如何解析?
你不如自己继承对话框,类似MSN/QQ消息提示框。有很多这样的例子。
HWND hWnd = GetParent();
m_cToolTip.Create(hWnd);
m_cToolTip.Activate(true);
m_cToolTip.AddTool(hWnd,_T("ToolTip"));
MSG msg;
msg.hwnd = hWnd;
msg.message = uMsg;
msg.lParam = lParam;
msg.wParam = wParam;
m_cToolTip.RelayEvent(&msg);
2.OnInitDialog()中添加
m_tooltip.Create(this);
m_tooltip.AddTool(GetDlgItem(IDOK),"点击此处确认退出");
m_tooltip.AddTool(GetDlgItem(IDCANCEL),"点击此处确认退出");
3.重载虚函数:PreTranslateMessage(MSG* pMsg)
添加代码:
if ( m_tooltip )
{
m_tooltip.RelayEvent( pMsg );
}
应该可以吧!
HWND hwndTip;
TOOLINFO ti;
icc.dwSize = sizeof(INITCOMMONCONTROLSEX);
icc.dwICC =ICC_BAR_CLASSES | ICC_TAB_CLASSES | ICC_WIN95_CLASSES ; InitCommonControlsEx(&icc); if(Balloon)//If you have choosen the Boolen Toop Tip will set the Windows style according to that
{
hwndTip = CreateWindowEx(NULL, TOOLTIPS_CLASS, NULL,
WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP |TTS_BALLOON,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
hWnd, NULL, hInst,
NULL);
}
else
{ hwndTip = CreateWindowEx(NULL, TOOLTIPS_CLASS, NULL,
WS_POPUP | TTS_NOPREFIX |TTS_ALWAYSTIP,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
hWnd, NULL, hInst,
NULL);
} SendMessage(hwndTip,TTM_ACTIVATE,TRUE,0); //Will Active the Tool Tip Control ti.cbSize = sizeof(TOOLINFO);
ti.uFlags = TTF_IDISHWND | TTF_SUBCLASS;
ti.hwnd = hWnd; //Handle of the window in which the Contol resides
ti.uId =(UINT)GetDlgItem(hWnd,id); //ID of the Cotrol for which Tool Tip will be Displyed
ti.hinst = hInst;
ti.lpszText = Tip; //Tip you want to Display;
ti.rect.left = ti.rect.top = ti.rect.bottom = ti.rect.right = 0; if(!SendMessage(hwndTip,TTM_ADDTOOL,0,(LPARAM)&ti)){ //Will add the Tool Tip on Control
MessageBox(NULL,L"Couldn't create the ToolTip control.",L"Error",MB_OK); } return TRUE;