systray menu overlaps

  • Thread starter Thread starter Guest
  • Start date Start date
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.
 
I realized that this is my machine specific. In other words, it only happens
on my XP development machine where all kinds of developement tools are
installed.
I downloaded a program from
http://www.thecodeproject.com/shell/ashsystray.asp?forumid=2978&select=1285812&df=100&msg=1285812
and the sample EXE also behaved same. Also Palm Desktop icon too.
However, Outlook2003 icon, Volume Control icon, Winzip icon, McAfee icon and
pcAnywhere icon behave correctly.

When those problematic programs were tested on the test machines, e.g.
Win2000 Server / Win2003 Server / XP, that overlapping doesn't occur.

Anyone know what could cause that problem?

Thanks!
 
Back
Top