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. Urgent Help Needed

Urgent Help Needed

Scheduled Pinned Locked Moved C / C++ / MFC
xmlhelpquestion
5 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.
  • B Offline
    B Offline
    Binayak
    wrote on last edited by
    #1

    Hi, From my SDI application I can open XML documents in my application using the Menus File | Open. I want to open the XML documents in my application by right-clicking on the XML document and then selecting Open With and selecting my application. Can anyone please tell me how I can do that? It’s urgent Thanks in advance

    J W 2 Replies Last reply
    0
    • B Binayak

      Hi, From my SDI application I can open XML documents in my application using the Menus File | Open. I want to open the XML documents in my application by right-clicking on the XML document and then selecting Open With and selecting my application. Can anyone please tell me how I can do that? It’s urgent Thanks in advance

      J Offline
      J Offline
      Jorgen Sigvardsson
      wrote on last edited by
      #2

      Basically, you need to create a menu in the resource entry. Create a new menubar, but don't add the menubar to your frame window. Now make a submenu and add your menu items. Make sure the "Open With" entry has the same ID as "Menu File | Open". This will reuse your already existing code to open an XML document since it will call the event handler you already have in your message map. In your application you need to trap the right click event, i.e. WM_RBUTTONDOWN. Then fire up the submenu using this (pseudo)code:

      HMENU hMenuBar = ::LoadMenu(hInstance, ID_OF_YOUR_NEWLY_CREATED_MENUBAR);
      HMENU hSubMenu = ::GetSubMenu(hMenuBar, 0); // Assuming your submenu is the first menu on the menu bar
      TrackPopupMenuEx(hSubMenu, TPM_SEE_MSDN_DOCS, x_coord, y_coord, 0, m_hWndOfEventReceiveingWindow, NULL);

      Since you didn't specify what toolkit you are using, I used the Win32 API. If you are using MFC or ATL/WTL, you can easily find the corresponding functions since they more or less map 1:1 -- Sancte Míchael Archángele, defénde nos in proélio contra nequítiam et insídias diáboli esto præsídium. Imperet illi Deus, súpplices deprecámur: tuque, princeps milítiæ cæléstis, Sátanam aliósque spíritus malígnos, qui ad perditiónem animárum pervagántur in mundo, divína virtúte, In inférnum detrude. Amen.

      B 1 Reply Last reply
      0
      • J Jorgen Sigvardsson

        Basically, you need to create a menu in the resource entry. Create a new menubar, but don't add the menubar to your frame window. Now make a submenu and add your menu items. Make sure the "Open With" entry has the same ID as "Menu File | Open". This will reuse your already existing code to open an XML document since it will call the event handler you already have in your message map. In your application you need to trap the right click event, i.e. WM_RBUTTONDOWN. Then fire up the submenu using this (pseudo)code:

        HMENU hMenuBar = ::LoadMenu(hInstance, ID_OF_YOUR_NEWLY_CREATED_MENUBAR);
        HMENU hSubMenu = ::GetSubMenu(hMenuBar, 0); // Assuming your submenu is the first menu on the menu bar
        TrackPopupMenuEx(hSubMenu, TPM_SEE_MSDN_DOCS, x_coord, y_coord, 0, m_hWndOfEventReceiveingWindow, NULL);

        Since you didn't specify what toolkit you are using, I used the Win32 API. If you are using MFC or ATL/WTL, you can easily find the corresponding functions since they more or less map 1:1 -- Sancte Míchael Archángele, defénde nos in proélio contra nequítiam et insídias diáboli esto præsídium. Imperet illi Deus, súpplices deprecámur: tuque, princeps milítiæ cæléstis, Sátanam aliósque spíritus malígnos, qui ad perditiónem animárum pervagántur in mundo, divína virtúte, In inférnum detrude. Amen.

        B Offline
        B Offline
        Binayak
        wrote on last edited by
        #3

        why do I need to create a menu? I guess I didn't make my problem clear enough. any xml file in my computer-> right-click on it->Open With->Choose Program ->Other -> brows to and select my program -> OK. so no menu creation is needed. Now I just want to know if I do that how the XML file name is passed to my application and where do I capture that name to work on it.

        J 1 Reply Last reply
        0
        • B Binayak

          why do I need to create a menu? I guess I didn't make my problem clear enough. any xml file in my computer-> right-click on it->Open With->Choose Program ->Other -> brows to and select my program -> OK. so no menu creation is needed. Now I just want to know if I do that how the XML file name is passed to my application and where do I capture that name to work on it.

          J Offline
          J Offline
          Jorgen Sigvardsson
          wrote on last edited by
          #4

          Ah, you want to create a shell extension. Have you looked around here?[^] Michael Dunns "The Complete Idiot's Guide to Writing Shell Extensions" should get you going. -- Sancte Míchael Archángele, defénde nos in proélio contra nequítiam et insídias diáboli esto præsídium. Imperet illi Deus, súpplices deprecámur: tuque, princeps milítiæ cæléstis, Sátanam aliósque spíritus malígnos, qui ad perditiónem animárum pervagántur in mundo, divína virtúte, In inférnum detrude. Amen.

          1 Reply Last reply
          0
          • B Binayak

            Hi, From my SDI application I can open XML documents in my application using the Menus File | Open. I want to open the XML documents in my application by right-clicking on the XML document and then selecting Open With and selecting my application. Can anyone please tell me how I can do that? It’s urgent Thanks in advance

            W Offline
            W Offline
            WoutL
            wrote on last edited by
            #5

            Just take a look at the registry: HK_CLASSES_ROOT\xmlfile\shell\Open\command That should give you some idees. Wout Louwers

            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