解决方案 »

  1.   

    处理ListView的WM_CONTEXTMENU消息,OnContextMenu(CWnd* pWnd, CPoint pos),然后根据pos的位置作判断再CreatePopupMenu
      

  2.   

    listview应该只有LVN_COLUMNCLICK消息,没有直接处理右键的消息,而且列表头的右键不能直接处理listview的NM_RCLICK
      

  3.   

    正如laiyiling(【CSDN●】) 所说:
    ListView没有区分右键的单击列表头事件的参数。
    一般我们总是习惯于,对列表头单击左键为排序,单击右键为弹出菜单!不知道能不能不用子类就能实现呢?另外laiyiling(【CSDN●】) 老兄,
    你写的那些俺都没有啊,俺只有VB,那个API查看器里的东东少得可怜,
    能不能再详细说一下它的具体值是多少?
      

  4.   

    事实上,我在你的另外一个问题
    http://community.csdn.net/Expert/topic/4527/4527459.xml?temp=.6329157中,已经给出这个问题的答案了,不知道你仔细看了没有,将窗体代码修改一下即可:
    Option ExplicitPrivate Sub Form_Load()  With ListView1.ListItems.Add(, , "d")
        .ListSubItems.Add , , "d1"
        .ListSubItems.Add , , "d2"
      End With
      With ListView1.ListItems.Add(, , "e")
        .ListSubItems.Add , , "e1"
        .ListSubItems.Add , , "e2"
      End With
      With ListView1.ListItems.Add(, , "f")
        .ListSubItems.Add , , "f1"
        .ListSubItems.Add , , "f2"
      End With
        
      Call RegisterListView(ListView1)End SubPrivate Sub Form_Unload(Cancel As Integer)  Call UnregisterListView(ListView1)End SubPublic Function ListView1_HeaderEvent(ByVal Action As lvHeaderActions, ByVal Column As Long) As Boolean  If Action = lvHeaderActionRightClick Then
        PopupMenu mnuhello '把mnuhello换成你的菜单名
      End If
      
    End Function