I found my problem using Easy Detection of Memory Leaks[^].
BOOL CSmartToolTip::SetTipText(CWnd *pTipOwnerWnd, CString strTip )
{
TOOLINFO ti;
\_CreateTipWnd();
// Fill tool tip info structure:
// (Set flags to indicates that the uId member is the window handle
// to the tool, and to indicate that the ToolTip control should subclass
// the tool's window to intercept messages.)
ti.cbSize = sizeof(ti); // size of this structure
ti.uFlags = TTF\_IDISHWND | TTF\_SUBCLASS; // flags
ti.hwnd = pTipOwnerWnd->GetParent()->GetSafeHwnd(); // handle to the window that contains the tool
ti.uId = (UINT)pTipOwnerWnd->GetSafeHwnd(); // application-defined identifier of the tool
ti.hinst = AfxGetResourceHandle(); // handle to the instance that contains the string resource for the tool
ti.lpszText = (LPTSTR)((LPCTSTR)strTip); // pointer to the buffer that contains the text for the tool
// Send add tool message and return result:
// return CToolTipCtrl::AddTool( pTipOwnerWnd->GetParent(), 1 );
return((BOOL)SendMessage(TTM\_ADDTOOL, 0, (LPARAM)&ti));
}
void CSmartToolTip::_CreateTipWnd()
{
// We must create its once!
if( ! IsWindow(*this) )
{
// Create ToolTip control
this->Create( NULL );
SetTipBkColor( RGB( 255, 255, 0) );
SetTipTextColor( RGB( 0, 0, 0) );
// Enable multiline
::SendMessage( \*this, TTM\_SETMAXTIPWIDTH, 0,
(LPARAM)(INT) MAKELONG(400, 0));
}
}
The problem located in above code. I periodically call above function in my application. But why leak? Can any one help me please?