R
Ramanji Keerthi
Guest
Hi
I am working on MFC application Migrating from VC++6.0 to VS2015. After application migrated to VS2015, ToolTip is working for few of window controls and not working for few of window controls.
We were used to create own custom windows by using GridCtrl (for business) and implemented OnNotify() function for every window and in this function implemented ToolTip event message handler(GCN_WANTTOOLTIP) and in each window called EnableToolTips() function.
ToolTip is handling for all of windows by using GridCtrl::OnNotify () function by sending WM_NOTIFY event to corresponding windows and for few of window were handled by using OnToolTipNotify() function by sending WM_NOTIFY event to corresponding windows as in below snipet .
Used below handler in message map.
ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTW, 0, 0xFFFF, OnToolTipNotify)
ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTA, 0, 0xFFFF, OnToolTipNotify)
ToolTip was worked in VC6.0 proper. But after migration getting ToolTip for few of windows only and break point is not hitting even in CGridCtrl::OnNotify() and CGridCtrl::OnToolTipNotify() functions for mousemove.
Note: The other windows which are, where tooltip is not worked proper in VS2015, it worked in VC6.0 through CGridCtrl::OnToolTipNotify(). But why it is not working on Migrated application ?
Can anyone provide solution will be great help to me.
Please let me know if you need any other details.
BOOL CGridCtrl::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
{
*pResult = TRUE;
if(wParam == ID_HDRCTRL)
{
LPNMHEADER pHdr = (LPNMHEADER) lParam;
LRESULT lResult = TRUE;
m_tNotifiyStruct.Header.hwndFrom = m_hWnd;
m_tNotifiyStruct.Header.idFrom = GetDlgCtrlID();
m_tNotifiyStruct.nRowID = m_nRowSelected;
m_tNotifiyStruct.nColID = pHdr->iItem;
m_tNotifiyStruct.nFlags = pHdr->iButton;
m_tNotifiyStruct.nChar = NULL;
switch(pHdr->hdr.code)
{
case 1:
{
…
lResult = GetOwner()->SendMessage(WM_NOTIFY,
m_tNotifiyStruct.Header.idFrom, (LPARAM) &m_tNotifiyStruct);
….
}
case 2:
{
…
lResult = GetOwner()->SendMessage(WM_NOTIFY,
m_tNotifiyStruct.Header.idFrom, (LPARAM) &m_tNotifiyStruct);
….
}
}
…
else if(wParam >= 0 && wParam < m_nCols)
{
…
lResult = GetOwner()->SendMessage(WM_NOTIFY,
m_tNotifiyStruct.Header.idFrom, (LPARAM) &m_tNotifiyStruct);
…
}
….
return CWnd::OnNotify(wParam, lParam, pResult);
}
BOOL CGridCtrl::OnToolTipNotify(UINT id, NMHDR * pNMHDR, LRESULT * pResult)
{
TOOLTIPTEXTA* pTTTA = (TOOLTIPTEXTA*)pNMHDR;
TOOLTIPTEXTW* pTTTW = (TOOLTIPTEXTW*)pNMHDR;
UINT nID = pNMHDR->idFrom;
if(nID != 0)
{
if(nID == (UINT) GetDlgCtrlID())
{
m_tNotifiyStruct.Header.hwndFrom = m_hWnd;
m_tNotifiyStruct.Header.idFrom = GetDlgCtrlID();
m_tNotifiyStruct.nRowID = nRow; // row id of cell under the cursor
m_tNotifiyStruct.nColID = nCol; // col id of cell under the cursor
m_tNotifiyStruct.nFlags = GCI_CELL; // on a cell
m_tNotifiyStruct.nChar = (UINT) &szTipText; // the string where tooltip text can be sent
m_tNotifiyStruct.Header.code = GCN_WANTTOOLTIP;
// send notification
lResult = GetOwner()->SendMessage(WM_NOTIFY,
m_tNotifiyStruct.Header.idFrom, (LPARAM) &m_tNotifiyStruct);
}
}
}
Ex: Status window notify function prototype
BOOL COrderStatusWinFO::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
{
if( pNfyMsg->Header.code == GCN_WANTTOOLTIP)
{
….
}
}
Continue reading...
I am working on MFC application Migrating from VC++6.0 to VS2015. After application migrated to VS2015, ToolTip is working for few of window controls and not working for few of window controls.
We were used to create own custom windows by using GridCtrl (for business) and implemented OnNotify() function for every window and in this function implemented ToolTip event message handler(GCN_WANTTOOLTIP) and in each window called EnableToolTips() function.
ToolTip is handling for all of windows by using GridCtrl::OnNotify () function by sending WM_NOTIFY event to corresponding windows and for few of window were handled by using OnToolTipNotify() function by sending WM_NOTIFY event to corresponding windows as in below snipet .
Used below handler in message map.
ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTW, 0, 0xFFFF, OnToolTipNotify)
ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTA, 0, 0xFFFF, OnToolTipNotify)
ToolTip was worked in VC6.0 proper. But after migration getting ToolTip for few of windows only and break point is not hitting even in CGridCtrl::OnNotify() and CGridCtrl::OnToolTipNotify() functions for mousemove.
Note: The other windows which are, where tooltip is not worked proper in VS2015, it worked in VC6.0 through CGridCtrl::OnToolTipNotify(). But why it is not working on Migrated application ?
Can anyone provide solution will be great help to me.
Please let me know if you need any other details.
BOOL CGridCtrl::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
{
*pResult = TRUE;
if(wParam == ID_HDRCTRL)
{
LPNMHEADER pHdr = (LPNMHEADER) lParam;
LRESULT lResult = TRUE;
m_tNotifiyStruct.Header.hwndFrom = m_hWnd;
m_tNotifiyStruct.Header.idFrom = GetDlgCtrlID();
m_tNotifiyStruct.nRowID = m_nRowSelected;
m_tNotifiyStruct.nColID = pHdr->iItem;
m_tNotifiyStruct.nFlags = pHdr->iButton;
m_tNotifiyStruct.nChar = NULL;
switch(pHdr->hdr.code)
{
case 1:
{
…
lResult = GetOwner()->SendMessage(WM_NOTIFY,
m_tNotifiyStruct.Header.idFrom, (LPARAM) &m_tNotifiyStruct);
….
}
case 2:
{
…
lResult = GetOwner()->SendMessage(WM_NOTIFY,
m_tNotifiyStruct.Header.idFrom, (LPARAM) &m_tNotifiyStruct);
….
}
}
…
else if(wParam >= 0 && wParam < m_nCols)
{
…
lResult = GetOwner()->SendMessage(WM_NOTIFY,
m_tNotifiyStruct.Header.idFrom, (LPARAM) &m_tNotifiyStruct);
…
}
….
return CWnd::OnNotify(wParam, lParam, pResult);
}
BOOL CGridCtrl::OnToolTipNotify(UINT id, NMHDR * pNMHDR, LRESULT * pResult)
{
TOOLTIPTEXTA* pTTTA = (TOOLTIPTEXTA*)pNMHDR;
TOOLTIPTEXTW* pTTTW = (TOOLTIPTEXTW*)pNMHDR;
UINT nID = pNMHDR->idFrom;
if(nID != 0)
{
if(nID == (UINT) GetDlgCtrlID())
{
m_tNotifiyStruct.Header.hwndFrom = m_hWnd;
m_tNotifiyStruct.Header.idFrom = GetDlgCtrlID();
m_tNotifiyStruct.nRowID = nRow; // row id of cell under the cursor
m_tNotifiyStruct.nColID = nCol; // col id of cell under the cursor
m_tNotifiyStruct.nFlags = GCI_CELL; // on a cell
m_tNotifiyStruct.nChar = (UINT) &szTipText; // the string where tooltip text can be sent
m_tNotifiyStruct.Header.code = GCN_WANTTOOLTIP;
// send notification
lResult = GetOwner()->SendMessage(WM_NOTIFY,
m_tNotifiyStruct.Header.idFrom, (LPARAM) &m_tNotifiyStruct);
}
}
}
Ex: Status window notify function prototype
BOOL COrderStatusWinFO::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
{
if( pNfyMsg->Header.code == GCN_WANTTOOLTIP)
{
….
}
}
Continue reading...