listview处理右键消息弹不出菜单
//消息处理LRESULT UserListViewNotify (HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam)
{
HINSTANCE hInst=GetModuleHandle(NULL);
switch (((LPNMHDR) lParam)->code)
{
case NM_RCLICK:
HMENU hMenu,hTrackMenu;
POINT point;
hMenu=LoadMenu(hInst,TEXT("USERPOPUP"));
hTrackMenu = GetSubMenu (hMenu, 0);
GetCursorPos(&point);
TrackPopupMenu(hTrackMenu,TPM_LEFTALIGN,point.x,point.y,0,hwnd,NULL);
break;
}
return TRUE;
}
//菜单定义
USERPOPUP MENU DISCARDABLE
BEGIN
POPUP "user"
BEGIN
MENUITEM "删除" IDM_USER_DEL
MENUITEM "禁用" IDM_USER_DIS
END
END