SteveMac wrote:
I am using VS2003 VC++ .NET.
I want to make a tray icon with a popup menu (like a context menu) that
pops up for a left click.
I can make the notifyicon with a context menu and that works fine, but
I really want it to show the menu for a left click, exactly as it would
for a right click.
SteveMac
If you are using unmanaged C++, then refer to the following link
http://www.microsoft.com/msj/archive/sdbea.htm#fig1
Try to use WM_RBUTTONUP instead of WMLBUTTONUP.
if (lEvent==WM_RBUTTONUP) {
// Make first menu item the default (bold font)
::SetMenuDefaultItem(pSubMenu->m_hMenu, 0, TRUE);
// Display the menu at the current mouse location. There's a "bug"
// (Microsoft calls it a feature) in Windows 95 that requires calling
// SetForegroundWindow. To find out more, search for Q135788 in MSDN.
//
CPoint mouse;
GetCursorPos(&mouse);
::SetForegroundWindow(m_nid.hWnd);
::TrackPopupMenu(pSubMenu->m_hMenu, 0, mouse.x, mouse.y, 0,
m_nid.hWnd, NULL);
}