Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Menu DrawItem issue when Windows 7 workstation is locked.

Menu DrawItem issue when Windows 7 workstation is locked.

Scheduled Pinned Locked Moved C / C++ / MFC
helpdatabasehardwarequestionannouncement
7 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Maxwell Chen
    wrote on last edited by
    #1

    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:

    1. Keep the application window open.
    2. Press Ctrl-Alt-Del, and choose "Lock this computer".
    3. Have the application pop up the context menu. In my case, it is the hardware signal input as the trigger.
    4. Input Windows password to unlock the screen.
    5. 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 call CMenu::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

    S 1 Reply Last reply
    0
    • M 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:

      1. Keep the application window open.
      2. Press Ctrl-Alt-Del, and choose "Lock this computer".
      3. Have the application pop up the context menu. In my case, it is the hardware signal input as the trigger.
      4. Input Windows password to unlock the screen.
      5. 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 call CMenu::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

      S Offline
      S Offline
      Stuart Dootson
      wrote on last edited by
      #2

      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!

      M 1 Reply Last reply
      0
      • S Stuart Dootson

        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!

        M Offline
        M Offline
        Maxwell Chen
        wrote on last edited by
        #3

        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

        S 1 Reply Last reply
        0
        • M Maxwell Chen

          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

          S Offline
          S Offline
          Stuart Dootson
          wrote on last edited by
          #4

          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!

          M 1 Reply Last reply
          0
          • S Stuart Dootson

            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!

            M Offline
            M Offline
            Maxwell Chen
            wrote on last edited by
            #5

            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

            S 1 Reply Last reply
            0
            • M 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

              S Offline
              S Offline
              Stuart Dootson
              wrote on last edited by
              #6

              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!

              M 1 Reply Last reply
              0
              • S Stuart Dootson

                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!

                M Offline
                M Offline
                Maxwell Chen
                wrote on last edited by
                #7

                OK. Thanks for your suggestion. :)

                Maxwell Chen

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups