I'm programming a C# program which listens for Space pressed in the File Explorer. When space is pressed I create a WPF window which shows the selected File in a WPF Window.
The only problem is, that this file Preview is also called when someone is editing the filename and presses space for a whitespace in the filename.
Is there a way to detect if a user is renaming a file at the moment?
Additional Information:
I know that i could listen for F2, but there's also the way to start renaming a file by clicking two times with the left mouse button or by right clicking the file and selecting rename. So this would be no good solution.
Technical Information (if needed):
I use GetForegroundWindow to check if the Window in the foreground is a explorer window. Then i use Hooks to listen for the pressed Keys in the explorer process in foreground.
To get the selected Item i use SHDocVw and Shell32
Shell32.FolderItems selectedItems = ((Shell32.IShellFolderViewDual2) window.Document).SelectedItems();