Menu DrawItem issue when Windows 7 workstation is locked.
-
I use CNewMenu V1.23 to pop up a context menu. It is working fine under most of situations, except the situation when the screen is locked by winlogon. The symptom is that it pops up only a black rectangle, as the screenshot in below link. Screenshot[^] The step to reproduce is:
- Keep the application window open.
- Press Ctrl-Alt-Del, and choose "Lock this computer".
- Have the application pop up the context menu. In my case, it is the hardware signal input as the trigger.
- Input Windows password to unlock the screen.
- The popup menu is black (blank).
CNewMenu::DrawItem
was only invoked when the menu was popping up. And the parent window (the owner of the menu) is still stuck by the callCMenu::TrackPopupMenu
. There is no signal to let the menu repaint / redraw at the moment the screen is being unlocked. Is there any method to cause the menu to update?Maxwell Chen
-
I use CNewMenu V1.23 to pop up a context menu. It is working fine under most of situations, except the situation when the screen is locked by winlogon. The symptom is that it pops up only a black rectangle, as the screenshot in below link. Screenshot[^] The step to reproduce is:
- Keep the application window open.
- Press Ctrl-Alt-Del, and choose "Lock this computer".
- Have the application pop up the context menu. In my case, it is the hardware signal input as the trigger.
- Input Windows password to unlock the screen.
- The popup menu is black (blank).
CNewMenu::DrawItem
was only invoked when the menu was popping up. And the parent window (the owner of the menu) is still stuck by the callCMenu::TrackPopupMenu
. There is no signal to let the menu repaint / redraw at the moment the screen is being unlocked. Is there any method to cause the menu to update?Maxwell Chen
This'll be because that thread is in a modal loop handling messages to do with the menu and so never gets the unlock message. And let's be honest, popping up a context menu on an asynchronous, non-user trigger is bad, m'kay? If the user is doing something else at the time, you're really upsetting their sense of what's happening, which is going to really going to get on their nerves... Why not start some sort of attention seeking notification (a pulsing icon, say) when the hardware trigger comes in and let the user access the context menu when they want to. Applications that are too pushy are a PITA...
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p CodeProject MVP for 2010 - who'd'a thunk it!
-
This'll be because that thread is in a modal loop handling messages to do with the menu and so never gets the unlock message. And let's be honest, popping up a context menu on an asynchronous, non-user trigger is bad, m'kay? If the user is doing something else at the time, you're really upsetting their sense of what's happening, which is going to really going to get on their nerves... Why not start some sort of attention seeking notification (a pulsing icon, say) when the hardware trigger comes in and let the user access the context menu when they want to. Applications that are too pushy are a PITA...
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p CodeProject MVP for 2010 - who'd'a thunk it!
It is an audio application. When user plugs in a jack, this application window is brought to foreground, and asks the user to choose the type of the device (PC speakers, headphone, or mic) which the user is plugging in. :) Just like the way you plug in a USB disk, you see a popup dialog box for choosing something. Of course user can decide not to choose any when it pops up the menu.
Maxwell Chen
modified on Thursday, February 4, 2010 2:47 AM
-
It is an audio application. When user plugs in a jack, this application window is brought to foreground, and asks the user to choose the type of the device (PC speakers, headphone, or mic) which the user is plugging in. :) Just like the way you plug in a USB disk, you see a popup dialog box for choosing something. Of course user can decide not to choose any when it pops up the menu.
Maxwell Chen
modified on Thursday, February 4, 2010 2:47 AM
I would suggest using some mechanism other than a menu...
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p CodeProject MVP for 2010 - who'd'a thunk it!
-
I would suggest using some mechanism other than a menu...
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p CodeProject MVP for 2010 - who'd'a thunk it!
I think the reason my colleague chose to use the owner draw menu was because it could be placed at the desired position. As the example in the sample screenshot[^], it indicates the choices are for the 3rd port (the donut icon), not for the 1st and the 2nd port.
Maxwell Chen
-
I think the reason my colleague chose to use the owner draw menu was because it could be placed at the desired position. As the example in the sample screenshot[^], it indicates the choices are for the 3rd port (the donut icon), not for the 1st and the 2nd port.
Maxwell Chen
You can position any window the way you can a menu. The main issue is the modal message loop the menu enters. That's what you need to workaround somehow.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p CodeProject MVP for 2010 - who'd'a thunk it!
-
You can position any window the way you can a menu. The main issue is the modal message loop the menu enters. That's what you need to workaround somehow.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p CodeProject MVP for 2010 - who'd'a thunk it!
OK. Thanks for your suggestion. :)
Maxwell Chen