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