В Н файле обьяви меню: CMenu TrayMenu;
Потом в реакцию на правую кнопку вставь :
Код | POINT pt; GetCursorPos(&pt); TrayMenu.DestroyMenu(); TrayMenu.CreatePopupMenu(); TrayMenu.InsertMenu(0,MF_BYPOSITION,1300,"About..."); TrayMenu.InsertMenu(1,MF_SEPARATOR | MF_BYPOSITION,0,""); TrayMenu.InsertMenu(2,MF_BYPOSITION,1301,"Open"); TrayMenu.InsertMenu(3,MF_BYPOSITION,1302,"Close"); TrayMenu.TrackPopupMenu(TPM_LEFTALIGN | TPM_LEFTBUTTON,pt.x,pt.y,this);
Функция обработки меню: BOOL COхххConfDlg::OnCommand(WPARAM wParam, LPARAM lParam) { CAboutDlg Adlg; switch(wParam) { case 1300:// about Adlg.DoModal(); break; case 1301:// open ModifyStyle(0,WS_VISIBLE); BringWindowToTop(); Invalidate(); Shell_NotifyIcon(NIM_DELETE,&MyND); break;
case 1302:// exit Shell_NotifyIcon(NIM_DELETE,&MyND); if(dlg.DoModal() == IDOK) CDialog::DestroyWindow(); break;
} return CDialog::OnCommand(wParam, lParam); }
|
|