Because of some bug in the Explorer shell the menu isn't dismissed when someone clicks outside of it, so I had to add the following code to accommodate for that (which can be found throughout Win32 forums online):
That takes away that bug, but what happens is that at times when my tray icon is first displayed on the task bar's tray and I try to right-click it, I get my pop-up menu and also get the default task bar menu (picture below) displayed over it, as if I right-clicked the task bar itself. This happens only the first time I right-click my tray icon.
Can someone tell me why this happens and how to remedy that?
PS. I'm running these tests on a Windows 7 with a default theme (and glass effect enabled).
Thanks, but I still get the same bug of two overlapping menus. I played a little with it, and to reproduce this bug you can add Sleep(500); after SetForegroundWindow call to make it come up for sure. I also believe that this only happens when some other window has keyboard focus (like any other Explorer window.)
Can someone tell me why this happens and how to remedy that?
It seems the effect has nothing to do with your code. I had the effect of the kind in regular Explorer window while right clicking an element without selecting it previously. So it's rather Win7 Explorer behavior.
Last edited by Igor Vartanov; September 29th, 2011 at 02:56 AM.
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.