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. Right click on listview item display context menu

Right click on listview item display context menu

Scheduled Pinned Locked Moved C / C++ / MFC
questionc++tutorial
4 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.
  • P Offline
    P Offline
    pgibson007700
    wrote on last edited by
    #1

    Hi I have a listview control, created with single selection, the list contains the names of printers, port names etc. When I right click an item how can I display the context menu that is displayed when you right click a printer object in Printers and Faxes ? i.e the user sees the same menu to be able to delete/rename printer, click the properties item etc. I'm using Visual C++ 6.0 on Windows XP, and know how to obtain a handle and open the printer in question and use the PrinterProperties call, but I want to display the menu as you can in Printers and Faxes. Thanks in advance

    H 1 Reply Last reply
    0
    • P pgibson007700

      Hi I have a listview control, created with single selection, the list contains the names of printers, port names etc. When I right click an item how can I display the context menu that is displayed when you right click a printer object in Printers and Faxes ? i.e the user sees the same menu to be able to delete/rename printer, click the properties item etc. I'm using Visual C++ 6.0 on Windows XP, and know how to obtain a handle and open the printer in question and use the PrinterProperties call, but I want to display the menu as you can in Printers and Faxes. Thanks in advance

      H Offline
      H Offline
      Hamid Taebi
      wrote on last edited by
      #2

      Hi pgibson007700 , Can you see to view context_menu in the right click?

      P 1 Reply Last reply
      0
      • H Hamid Taebi

        Hi pgibson007700 , Can you see to view context_menu in the right click?

        P Offline
        P Offline
        pgibson007700
        wrote on last edited by
        #3

        I have not written any code yet to process the right click, all I want to do is what Printers and faxes does i.e displays menu with Open, Printing Preferences..., Properties etc, remember my list control with only contain a text item, which is the name of the printer. Therefore I can obtain server name etc and use OpenPrinter to obtain a handle etc.

        H 1 Reply Last reply
        0
        • P pgibson007700

          I have not written any code yet to process the right click, all I want to do is what Printers and faxes does i.e displays menu with Open, Printing Preferences..., Properties etc, remember my list control with only contain a text item, which is the name of the printer. Therefore I can obtain server name etc and use OpenPrinter to obtain a handle etc.

          H Offline
          H Offline
          Hamid Taebi
          wrote on last edited by
          #4

          if you want to view Context_menu in the right click CMenu menu; menu.LoadMenu(IDR_MAINFRAME); CMenu *pContextMenu=menu.GetSubMenu(0); BOOL o=pContextMenu->InsertMenu(0, MF_BYPOSITION | MF_STRING | MF_DISABLED, 0, "StL OBJECT"); pContextMenu->TrackPopupMenu(TPM_LEFTALIGN|TPM_LEFTBUTTON|TPM_RIGHTBUTTON,point.x,point.y,AfxGetMainWnd()); /*{ CPoint point; GetCursorPos(&point); }*/ this section BOOL o=pContextMenu->InsertMenu(0, MF_BYPOSITION | MF_STRING | MF_DISABLED, 0, _T("or anything")); I reply to question and this is here it can to delete -- modified at 13:22 Sunday 12th March, 2006

          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