vc右键弹出托盘菜单 对应的消息函数内容可以减少置顶

来源:互联网 发布:知乎申请文书 编辑:程序博客网 时间:2024/06/05 23:54

 CMenu menu,*pmenu;
 pmenu=NULL;
 if (lParam==WM_RBUTTONDOWN)
 {
  POINT cursorPosition;
  GetCursorPos( &cursorPosition );
  menu.LoadMenu(IDR_RIGHTDOWN);
  pmenu=menu.GetSubMenu(0);
  PostMessage(WM_NULL,   0,   0   );    
   POINT   point;  
  GetCursorPos(   &point   );  
  SetForegroundWindow();  
  pmenu->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON,cursorPosition.x,cursorPosition.y,this);
  PostMessage(WM_NULL,   0,   0   );  
  
  
  //pmenu->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON,cursorPosition.x,cursorPosition.y,this);
 }