www.pudn.com > cygl.rar > MyToolTipCtrl.cpp
// MyToolTipCtrl.cpp : implementation file
//
#include "stdafx.h"
#include "cyglxt.h"
#include "MyToolTipCtrl.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMyToolTipCtrl
CMyToolTipCtrl::CMyToolTipCtrl()
{
}
CMyToolTipCtrl::~CMyToolTipCtrl()
{
}
BEGIN_MESSAGE_MAP(CMyToolTipCtrl, CToolTipCtrl)
//{{AFX_MSG_MAP(CMyToolTipCtrl)
// NOTE - the ClassWizard will add and remove mapping macros here.
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMyToolTipCtrl message handlers
BOOL CMyToolTipCtrl::AddToolTip(UINT nID, CRect lpRect, LPCTSTR lpszText)
{
TOOLINFO Tips;
lpRect.top = lpRect.top +50;
memset(&Tips, 0, sizeof(TOOLINFO));
Tips.cbSize = sizeof(TOOLINFO);
Tips.hwnd = GetOwner()->GetSafeHwnd();
Tips.uFlags = TTF_SUBCLASS;
Tips.uId = nID;
memcpy(&Tips.rect, lpRect, sizeof(RECT));
Tips.lpszText = (LPSTR)lpszText;
return (BOOL)SendMessage(TTM_ADDTOOL, 0, (LPARAM)&Tips);
}