none
Hiding A Pop Up Menu

    Question

  • Hey Guys,

     So I am trying to hide a pop up menu when another dialog appears. I tried destroying the pop up menu but that is too destructive and that disables the pop up menu all together. I simple want to force the menu back down and hide until the user clicks on the menu again.

    I tried forced a phantom screen tap to make the popup menu disappear. But I realized there are too many active areas on the screen and I might initiate an invalid command on the dialog.

    Does anyone know how to force a popup menu to go back down?

    Thanks,

    Norm

    Monday, March 12, 2007 5:40 AM

All replies

  • I forgot mention that I am running my application on a Windows Mobile 5 and also Pocket PC 2003.

    I am programming VC++ in .Net 2005.

    Thanks

    Monday, March 12, 2007 5:44 AM
  • If you want to try to simulate a keyboard event without accidentally pressing something, try this...

    keybd_event(VK_ATTN, 0, KEYEVENTF_SILENT, 0);

    Not sure if that will do the job or not.  I use that for keeping the screen from dimming during long operations in my software.

    You might also try finding the handle of that menu and sending it a message.  Use Remote Spy to see what the class name or window name is, then put a FindWindow call in your code to get the handle to that window.  Not sure if a popup menu will respond to WM_CLOSE, but it's worth a shot.

     

    Tuesday, March 13, 2007 12:11 PM
  • Interestingly enough, I tried that yesterday and it didn't seem to work. I tried simulating an "esc" key press. But the problem seems to be that the dialog is not listen anymore.

    In my program, I have the threads runnning. One thread is the program itself, while another thread communicates with devices. When a device is disconnected, the communication thread brings up a disconnection dialog and makes that dialog active.

    But I then need to tell the main program thread to close the popup menu that is in the application dialog. But since the program dialog is no longer active, the request to close the popup menu doesn't seem to be going through.

    Maybe I don't have the correct handle.

    Is there a universal call to close all popup menus? Regardless of who owns it?

    Thanks for the help though! :)

    Wednesday, March 14, 2007 12:25 AM
  • Does anyone have any suggestions? I've been stuck on this bloody bug for several days now.
    Monday, March 19, 2007 10:57 PM
  • Could try sendmessage so you can target the right window.
    Wednesday, March 21, 2007 9:34 PM
  • Hi!
    I know it's been a while since there where any activity in this thread but,
    I've run in to the same problem.
    Any solution to this yet?

    Thanx
    Thursday, September 20, 2007 9:47 AM
  • Hi again!
    After a couple of frustrating hours i finally resoved it by calling the
    BOOL ReleaseCapture(void)

    function before displaying the new  dialog.
    http://msdn2.microsoft.com/en-us/library/aa933042.aspx

    /Fritz




    Thursday, September 20, 2007 2:07 PM