Thread: context menu

  1. #1
    Registered User larry's Avatar
    Join Date
    Sep 2001
    Posts
    96

    context menu

    Displaying a context menu is supported only for popup menus in Windows. If you use TrackPopupMenuEx() you have to pass a handle to a popup menu (subenu). If you try to use it with the main menu handle, it displays only small thin line. But I need to display the whole menu like context, how can I accomplish this?
    Please excuse my poor english...

  2. #2
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    Use 'CreatePopupMenu' to return a handle (HMENU) to an empty menu then use 'InsertMenuItem' to add/append any menuitems you need. You can also use 'InsertMenu' and 'AppendMenu' to add menuitems.

    And your english is really good, Larry, so no apology is necessary
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

  3. #3
    Registered User larry's Avatar
    Join Date
    Sep 2001
    Posts
    96
    I've already tried this. It doesn't work. I think submenus are the problem. Try it if you don't believe me. I get the number of items in the "root" using GetMenuItemCount() and do a GetMenuItemInfo() call on every single item. I use obtained information with InsertMenuItem() which adds new item to the temporary popup menu.
    If you wonder what I meant by "it doesn't work", I'll describe it better. I have a menu resource and use this resource to display the main application menu (LoadMenu() function). And I need to display the same resource as a context menu. If I use the method we are talking about, the context menu displays only once and never appears again. And besides this, the main application menu "freezes".

    My english only seems to be good, sometimes it's really bad, but thanks anyway.
    Last edited by larry; 02-18-2002 at 01:59 PM.
    Please excuse my poor english...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 03-05-2009, 10:25 AM
  2. Another syntax error
    By caldeira in forum C Programming
    Replies: 31
    Last Post: 09-05-2008, 01:01 AM
  3. Context Menu cursor problem
    By dWorkVan in forum Windows Programming
    Replies: 4
    Last Post: 07-14-2003, 11:42 AM
  4. Double click for context menu?
    By mepaco in forum Windows Programming
    Replies: 1
    Last Post: 12-19-2002, 06:17 PM
  5. Context Menu & Dialog Box :: MFC
    By kuphryn in forum Windows Programming
    Replies: 4
    Last Post: 08-11-2002, 10:01 AM