Oui bien sûr
Voici le prototype de la fonction à déclarer :
afx_msg LRESULT OnTrayNotify(WPARAM wParam, LPARAM lParam);
Dans le message map ca reste identique :
ON_MESSAGE(WM_TRAY_MESSAGE,OnTrayNotify)
Et voici l'implémentation de la méthode :
(les valeurs de retour sont modifiées)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
afx_msg LRESULT OnTrayNotify(WPARAM wParam, LPARAM lParam)
{
if ((UINT)wParam != 1)
return 0;
POINT pt;
switch (lParam)
{
case WM_RBUTTONDOWN:
case WM_CONTEXTMENU:
GetCursorPos(&pt);
CMenu myMenu;
myMenu.LoadMenu(IDR_MENU1);
myMenu.GetSubMenu(0)->TrackPopupMenu(TPM_BOTTOMALIGN|TPM_LEFTBUTTON|TPM_RIGHTBUTTON, pt.x, pt.y, this);
break;
}
return 0;
} |
A+
Partager