How do I write a custom search provider for Windows Explorer search UI - windows

I am working on a Windows Explorer Namespace Extension which is a virtual filesystem. With regards to this, I would like to support search from the search dialog available in Windows Explorer.
Currently I'm able to search by name in the folder I'm standing in, but I would like to be able to search in the complete structure and also within content of the virtual filesystem, and since Windows Explorer cannot do this, I need to hook in a custom search provider.
Since it is a virtual filesystem, it would be beneficial if I could write a custom UI for displaying the result, but this isn't mandatory.
The custom Explorer namespace extension is written in C#, but the API doesn't need to be wrapped. Any pointers to API documentation, commercial products and/or samples would be appreciated.

If you are using defview as your shell view, return FWF_USESEARCHFOLDER in IFolderViewSettings::GetFolderFlags. Sample implementation can be found at http://regnamespace.codeplex.com/.
From http://msdn.microsoft.com/en-us/library/bb331575(v=vs.85).aspx :
If your IShellFolder implementation does not use SHCreateShellFolderView to create the DefView, the Shell view object may need IFolderView.
There is also confused user who need to support shell namespace extension folder searching in file dialogs.

Related

Replicate the share email to microsoft teams function

I am currently investigating a way to share emails from our desktop application. Written in c# using .Net framework 4.7
We would like to use the same dialog that gets initiated when you use the "Share to Teams" button in outlook passing in the .eml file. The user would be responsible for selecting which people or channels to share to.
Does anyone have any recommendations?
We can succesfully build a simple url share using their launcher concepts, but this is pretty limited to the browser and doesn't support files
https://teams.microsoft.com/share?href=www.stackoverflow.com&msgText=Testing
https://learn.microsoft.com/en-us/microsoftteams/platform/concepts/build-and-test/share-to-teams
And there is nothing mentioned in their deep-links section on msdn to achieve this
https://learn.microsoft.com/en-us/microsoftteams/platform/concepts/build-and-test/deep-links
If you're building your own desktop app experience anyway, why not use Graph for this? For instance, see https://learn.microsoft.com/en-us/graph/api/chatmessage-post?view=graph-rest-1.0&tabs=http . You'd need to do your own Search box, but you can do that on Graph also - here for instance is a channel listing endpoint (this example is for within a specific Team): https://learn.microsoft.com/en-us/graph/api/channel-list?view=graph-rest-1.0&tabs=http

Possible to include an image in the meta data in code? VS 2013

I would like to be able to include a screenshot of a control inside my code, this way making control identification easier for new members on my team, is such a thing possible?
Maybe even the ability to just have the image on a network share with the path in a comment, and then have a plugin that when hovering over the link brings up the image?
EDIT (More detail):
I'm creating a test project, the application under test has over 1000 controls, some of them are similar in name and purpose, this can make it difficult at times for developers to reuse the API I am creating because the control name is simply not enough for quick identification of the control in use.
I use the word API very loosely too, none of this stuff will be consumed in web services, and it will always be white box with developers including a project reference and have direct access to the source code.
For every form in my application (The test one), I have a controls.cs file where all the controls for that form in the application under test are listed - This is where I want the hover to screenshot ability in the control definitions.
Another sure factor is that all developers will be using VS2013 (For now the base version), later this could be update 1 or 2.
As the initial author and senior developer on this project, these hover / image references (in the code) will be as useful to me personally as any 3rd party developers, or any later developers to join the initiative.
Thanks again, and I added a bounty!
I believe you can use Whole Tomato's free SourceLinks Visual Studio extension to do what you want - or at least get pretty close to it.
Built-in Functionality:
Out of the box, the extension allows you to specify comment patterns you want users to be able to take an action on. Once the patterns are specified, SourceLinks will highlight any occurrences of those patterns in the text editor. You will be able to double click the highlighted items and perform a pre-configured action (such as opening a link in an internal/external browser, or launching an executable).
You can see an example in the SourceLinks configuration dialog shown below:
(source: wholetomato.com)
So you could use this feature pretty painlessly to define a keyword such as Control Image and then put comments like the following in your code:
// Control Image: my_smart_list.jpg
SourceLinks would allow you double click this text, and you could have that configured to launch the image (using a file:// or http:// url depending on how and where your images are stored) either inside Visual Studio in it's internal browser, or in an external browser.
Custom Tooltips!
Now, if you want to put in some more effort into this and actually write some code, then SourceLinks allows you to create API Extensions to display custom tooltips when the user hovers over the marked text in the editor. The default installation of SourceLinks comes with sample API extensions that you can copy to create your own. See the article linked at the very top of the answer for more details on these samples.
This post in the SourceLinks forum informs us that SourceLinks expects the custom API Extension to return the tooltip value as FlowDocument XAML text. This is awesome news for us, because a FlowDocument can contain many types of elements, including formatted text, hyperlinks, and images.
Imanges in a Flow document can be specified both inline as well as externally.
Hope this helps!
I would use doxygen -- create the images somewhere in the source tree and use doxygen comments. You can embed the \image command in source comments (see docs) and doxygen will generate all the HTML documentation from there. I think doxygen is a great tool for documenting a codebase as you can generate the documentation directly from comments in the source and distribute or host the HTML separately.

How to customize the windows shell to display files from a remote source and allow custom drawing?

Is it possible, (via some shell extension or similar) to customize the Windows shell (explorer.exe) to accomplish the following?
Make it, upon navigating to a predefined path:
draw over its surface - custom background, or even add custom forms for data input
display custom listview items based on the "virtual" path provided (something analogous to what explorer is doing when browsing a FTP repository - the items shown are not contents of a local folder, but rather some "virtual" items physically located on the FTP server)
The idea is to reuse the visage and navigation elements of Explorer without re-implementing the whole functionality and make it look native on all Windows versions for a remote file browser (file lists+files alone served by a custom web service).
I think you need to implement a Explorer Namespace Extension. There is some good information floating around on codeproject etc that you will probably need since the official documentation is not the best.

Implementing the IExtractImage COM interface

I see a lot of references to IExtractImage when researching how to generate thumbnails in explorer, and I cannot use the new API which is Vista/7 only as the target OS is XP.
Almost all the results I've found talk about using IExtractimage to acquire thumbnails, not implementing IExtractImage to create them. I don't want to retrieve thumbnails, I want to make them so that i can display a custom image format in windows explorer.
Those that do talk about what I want to do, give no examples, dont tell me how I would implement the IExtractImage object and tell me nothing about the APIs to use to actually draw to the thumbnail, and normally reference msdn articles which give 404 not found results.
I'm using c/c++
You want to implement IExtractImage (or IExtractImage2) and register it as a shell extension. A good article on this on CodeProject: http://www.codeproject.com/KB/shell/thumbextract.aspx

How can I filter by file type in an IExplorerBrowser in Windows 7 Libraries?

I've created an instance of IExplorerBrowser in my code to create a custom I/O view in one of my dialogs. I've implemented the IServiceProvider and ICommDlgBrowser interfaces in my host class. I use the IExplorerBrowser::BrowseToIDList method to fill the view.
I would like to filter the file types displayed (ex. only PNG files). If I call BrowseToIDList with FOLDERID_Pictures (i.e. "My Pictures") I can use the ICommDlgBrowser::IncludeObject method or IFolderFilter::ShouldShow to restrict which files I allow to be displayed. However, if I browse to the Picture Library on Windows 7 (FOLDERID_PicturesLibrary), neither ICommDlgBrowser::IncludeObject nor IFolderFilter::ShouldShow are ever called.
Is there some limitation to filtering files in libraries on Win7 that I'm unaware of? Perhaps I'm missing an interface or maybe I've specified the wrong flag somewhere.
Any ideas would be greatly appreciated.
I've had a chance to research this further, including asking a few questions to some Microsoft developers. It would appear, unfortunately, that filtering does not work with query backed views (i.e. Libraries).
An alternative to my approach would be to use the Common Item Dialog with application added controls (via IFileDialogCustomize).
(http://msdn.microsoft.com/en-us/library/bb776913(VS.85).aspx)
In my specific case, I'm unable to use a Common Item Dialog, but I thought it might be worthwhile to post this information here for future reference.
If in the future I find any way to filter an IExplorerBrowser control, I'll post that back here too.
I encountered this issue myself.
Yet I have investigated it a little bit further. IExplorerBrowser creates (on my Windows 7 x64 machine) window of ExplorerBrowserControl class. Which itself creates a window of DUIViewWndClassName class. And the very same window (DUIViewWndClassName) is used as a control by dialog created by IFileOpenDialog. Even window procedures are same so there is no subclassing (but I haven't checked each and every subwindow of that control).
And file dialogs are able to filter by file type even in the library folders. So I guess the IExplorerBrowser (or the control it uses) does allow that only Microsoft does not share knowledge how to do that. Or if it does then its somewhat hidden knowledge.
But I got it with IFolderFilterSite (interface supported by IExplorerBrowser from CLSID_ExplorerBrowser). IFolderFilter::ShouldShow isn't called in such cases for library folders. I wasn't able to get ICommDlgBrowser::IncludeObject called (even if I didn't set any IFolderFilter).
EDIT: I managed to get ICommDlgBrowser::IncludeObject called. Somehow I forgot that I have to provide ICommDlgBrowser through IServiceProvider::QueryService rather than through IUnknown::QueryInterface. But still ICommDlgBrowser::IncludeObject is not called for library folders.
I tried using IShellFolderViewDual3->FilterView().
But it's search results.
Thank you.
IShellView *pShellView;
IDispatch *pDSFV;
IShellFolderViewDual3 *pSFVD3;
m_pExplorerBrowser->GetCurrentView(IID_PPV_ARGS(&pShellView));
pShellView->GetItemObject(SVGIO_BACKGROUND, IID_PPV_ARGS(&pDSFV));
pDSFV->QueryInterface(IID_PPV_ARGS(&pSFVD3));
pSFVD3->FilterView(bstrVal);

Resources