BOOL CEnhancedListCtrl::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
{
// TODO: Add your specialized code here and/or call the base class
// wParam is zero for Header ctrl
LPNMHDR pNH = (LPNMHDR) lParam;
if( wParam == 0 && pNH->code == NM_RCLICK )
{
// Right button was clicked on header
CHeaderCtrl* pHeader = CListCtrl::GetHeaderCtrl();
if(pHeader){
CPoint pt(GetMessagePos());
CPoint posMouse=pt;
pHeader->ScreenToClient(&pt);
// Determine the column index
int index=-1;
CRect rcCol;
for( int i=0; pHeader->GetItemRect(i, &rcCol); i++ )
{
if( rcCol.PtInRect( pt ) )
{
index = i;
break;
}
}
*pResult=TRUE;
OnHeaderRClick(posMouse,i);
return TRUE;
}
}
return CListCtrl::OnNotify(wParam, lParam, pResult);
}
{
// TODO: Add your specialized code here and/or call the base class
// wParam is zero for Header ctrl
LPNMHDR pNH = (LPNMHDR) lParam;
if( wParam == 0 && pNH->code == NM_RCLICK )
{
// Right button was clicked on header
CHeaderCtrl* pHeader = CListCtrl::GetHeaderCtrl();
if(pHeader){
CPoint pt(GetMessagePos());
CPoint posMouse=pt;
pHeader->ScreenToClient(&pt);
// Determine the column index
int index=-1;
CRect rcCol;
for( int i=0; pHeader->GetItemRect(i, &rcCol); i++ )
{
if( rcCol.PtInRect( pt ) )
{
index = i;
break;
}
}
*pResult=TRUE;
OnHeaderRClick(posMouse,i);
return TRUE;
}
}
return CListCtrl::OnNotify(wParam, lParam, pResult);
}
解决方案 »
- 双击文件,打开执行程序
- 用inno setup打包安装如何在删除软件时也想同时运行某一个程序
- MFC通过ODBC数据源操作数据库是什么用户?
- MFC对话框嵌入asm源文件编译生成后运行出错!!
- 关于学习C++和编程的50个观点(转载)
- 征集广告词啊,发挥VC板块兄弟们的想象力啊!!我知道50分太少,但是我已经没有分了,以后有了在补上啊
- AfxGetApp()->m_pMainWnd 怎么得到的是 NULL 啊!
- ★★FindWindowEx的小问题★
- 我用了CHtmlView控件,有的网页中包含错误,于是就会报错,我怎么过滤这些报错呀?
- 关于数据存储的问题
- 我VC中的控件板找不到了。。。在哪可以显示出来?
- 这算是Windows的BUG吗???
{
if( wParam==0 && ((NMHDR*)lParam)->code ==NM_RCLICK)
{
POINT Point;
GetCursorPos (&Point);
ScreenToClient(&Point);
HDHITTESTINFO HitTest; HitTest.pt.x = Point.x;
HitTest.pt.y = Point.y;
// Send the Hit Test Message GetHeaderCtrl()->SendMessage(HDM_HITTEST,0,(LPARAM)&HitTest);
}
}The HDHITTESTINFO structure holds the column index in its iItem member. Finally on the part of my colleagues and me, we would like to thank codeguru for the immense help it has given us the last year.