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. Please Help! Open a menu programmatically?

Please Help! Open a menu programmatically?

Scheduled Pinned Locked Moved C / C++ / MFC
c++helptutorialquestion
3 Posts 3 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.
  • J Offline
    J Offline
    Jim Steele
    wrote on last edited by
    #1

    Can anyone tell me how to open a main menu programmatically? In my main frame class of an MFC MDI app I have a function (OnMenuChar) that needs to mimic the functionality of pressing Alt-F on the keyboard to open the File menu. I don't want to do anything other than that, such as open a file, just open the menu so the user can then make their own choice. I have tried several things to no avail. I can get the system menu to open, but not the main menu. Thanks in advance for any assistance! Jim

    D K 2 Replies Last reply
    0
    • J Jim Steele

      Can anyone tell me how to open a main menu programmatically? In my main frame class of an MFC MDI app I have a function (OnMenuChar) that needs to mimic the functionality of pressing Alt-F on the keyboard to open the File menu. I don't want to do anything other than that, such as open a file, just open the menu so the user can then make their own choice. I have tried several things to no avail. I can get the system menu to open, but not the main menu. Thanks in advance for any assistance! Jim

      D Offline
      D Offline
      Dmitriy
      wrote on last edited by
      #2

      Did you try HiliteMenuItem() function?

      1 Reply Last reply
      0
      • J Jim Steele

        Can anyone tell me how to open a main menu programmatically? In my main frame class of an MFC MDI app I have a function (OnMenuChar) that needs to mimic the functionality of pressing Alt-F on the keyboard to open the File menu. I don't want to do anything other than that, such as open a file, just open the menu so the user can then make their own choice. I have tried several things to no avail. I can get the system menu to open, but not the main menu. Thanks in advance for any assistance! Jim

        K Offline
        K Offline
        kasreng
        wrote on last edited by
        #3

        You can try the following /* Pass the handle to the window SetForegroundWindow(hwnd) // Pass alt- f keybd_event(VK_MENU,0,0,0); keybd_event('F',0,0,0); // Release alt keybd_event (VK_MENU, 0,KEYEVENTF_KEYUP ,0) Regards, Renga.

        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