Community.VisualStudio.Toolkit icon indicating copy to clipboard operation
Community.VisualStudio.Toolkit copied to clipboard

"Universal file handler" extension

Open astrohart opened this issue 3 years ago • 4 comments

Hello,

I want to write an extension that handles the case of when a file having any filename extension is submitted to the Visual Studio open file dialog. I have an idea along the lines of opening said file in its associated application, but it's slightly more involved than just that. I want to know how to take that file path, and feed to an instance of the associated application and then host that application's main window inside a tool window / document tab...so we can edit any file, in any application, right inside Visual Studio.

I know the ToolWindow extensibility would be the best bet, but I am unsure as to how to get access to the file path that the user submitted to the Open File dialog box, and it's one that VS does not know how to handle it.

Anyone have any suggestions as to which service I'd access for the OpenDocumentFile - esque behavior of VS?

astrohart avatar Jul 31 '22 16:07 astrohart

I'm unaware of any VS extension APIs that will enable you to do what you described above. Even it if were possible to host arbitrary windows from other applications inside a VS ToolWindow, I can foresee a lot of unexpected behavior and apps that don't work fully in such a scenario. Nice idea though.

mrlacey avatar Aug 02 '22 18:08 mrlacey

I want to know how to take that file path, and feed to an instance of the associated application and then host that application's main window inside a tool window / document tab

If I'm understanding correctly, that's basically impossible. A window from another process can't be put inside a Visual Studio tool window or document tab. Even taking Visual Studio out of the equation, I don't see how that would even be possible in a simple WPF application.

reduckted avatar Aug 04 '22 09:08 reduckted

It's actually fairly well-known and well-documented using Win32 API. There are examples if you just Google.

astrohart avatar Aug 04 '22 18:08 astrohart

BTW - everyone, I thought of this idea first. Copyright (c) xyLOGIX, LLC, patent pending.

astrohart avatar Aug 04 '22 18:08 astrohart