G
Guest
I wrote an MFC program whose icon, tooltip and menus are available in systray.
When I right-click on the icon, not only my popup menus but also the taskbar
popup menu, such as, "Toolbars", "Adjust Date/Time", etc. are displayed.
If I right-click one more time, then only my menus are displayed. This
happens alternatively. In other words, if I click again, then both menus are
displayed.
I followed the exact steps that were posted on MSDN, such as,
afx_msg LONG CAutoUpdatesDlg::OnSysTrayIconClick( WPARAM wParam, LPARAM
lParam )
{
switch (lParam){
case WM_LBUTTONDOWN:
OnSysTrayInstallupdates();
break;
case WM_RBUTTONDOWN:
ShowTrayPopupMenu();
break ;
}
// PostMessage( WM_NULL, 0, 0 );
return 0;
}
void CAutoUpdatesDlg::ShowTrayPopupMenu()
{
CMenu mnTrayPopup;
mnTrayPopup.LoadMenu(IDR_TRAY_POPUP);
POINT CurPos;
GetCursorPos (&CurPos);
CMenu *mnItem1 = mnTrayPopup.GetSubMenu(0);
SetForegroundWindow();
mnItem1->TrackPopupMenu( TPM_RIGHTBUTTON | TPM_RIGHTALIGN,
CurPos.x, CurPos.y, this );
PostMessage( WM_NULL, 0, 0 );
}
Is this a VC7 bug? Or am I missing anything?
TIA.
When I right-click on the icon, not only my popup menus but also the taskbar
popup menu, such as, "Toolbars", "Adjust Date/Time", etc. are displayed.
If I right-click one more time, then only my menus are displayed. This
happens alternatively. In other words, if I click again, then both menus are
displayed.
I followed the exact steps that were posted on MSDN, such as,
afx_msg LONG CAutoUpdatesDlg::OnSysTrayIconClick( WPARAM wParam, LPARAM
lParam )
{
switch (lParam){
case WM_LBUTTONDOWN:
OnSysTrayInstallupdates();
break;
case WM_RBUTTONDOWN:
ShowTrayPopupMenu();
break ;
}
// PostMessage( WM_NULL, 0, 0 );
return 0;
}
void CAutoUpdatesDlg::ShowTrayPopupMenu()
{
CMenu mnTrayPopup;
mnTrayPopup.LoadMenu(IDR_TRAY_POPUP);
POINT CurPos;
GetCursorPos (&CurPos);
CMenu *mnItem1 = mnTrayPopup.GetSubMenu(0);
SetForegroundWindow();
mnItem1->TrackPopupMenu( TPM_RIGHTBUTTON | TPM_RIGHTALIGN,
CurPos.x, CurPos.y, this );
PostMessage( WM_NULL, 0, 0 );
}
Is this a VC7 bug? Or am I missing anything?
TIA.