Reputation: 6547
I would like to write an application that runs next to Windows Explorer. Whenever a user does a selection of a folder or file, I would like to update my program, so the user can make an annotation to the file.
That is all it has to do. The information will be saved per file.
Is it possible to do this without a right-click context menu / (windows shell?)?
Upvotes: 1
Views: 2249
Reputation: 1
You can create a FileSystemWatcher in a Windows Form Project that is triggered when a filesystem change occurs. You can find the FileSystemWatcher in the Toolbox in Visual Studio.
https://msdn.microsoft.com/en-us/library/system.io.filesystemwatcher(v=vs.110).aspx
You can create a watcher for each drive (programmatically) and then ensure that "watch subfolders and subfolder items" is also enabled.
Upvotes: 0
Reputation: 371
you can use BHO, in the BHO DISPID_DOCUMENTCOMPLETE event handler you will get IShellFolderViewDual so you can Find ConnectionPoint of DIID_DShellFolderViewEvents and will recive DISPID_SELECTIONCHANGED event, see here for detail
Upvotes: 2
Reputation: 186
You can write an AutoHotkey script. Following script will check every 100ms and show a system tooltip with the name of the file/folder selected:
Previous=
Current=
Loop
{
Current :=GetExplorerSel()
If (Previous <> Current)
{
TrayTip, You have selected, %Current%, 10, 1
Previous = %Current%
}
Sleep 100
}
GetExplorerSel(hwnd="") {
hwnd := hwnd ? hwnd : WinExist("A")
WinGetClass class, ahk_id %hwnd%
if (class="CabinetWClass" or class="ExploreWClass")
for window in ComObjCreate("Shell.Application").Windows
if (window.hwnd==hwnd)
{
selected := window.Document.SelectedItems
for item in selected
ret .= item.path "`n"
return Trim(ret,"`n")
}
}
If you wish to use another language, just look into COM to interact with it.
Upvotes: 0