I wanted to add a feature to switch to the specific window (rather than previous active window) and execute auto type.
I was able to do so by modifying KeePass code directly and rebuilding it. Now I want to do the same thing as plug-in, but I have two questions.
1. m_host.MainWindow.ExecuteGlobalAutoType() does not work (no key is sent to the current window). Isn't this intended for this purpose?
2. How can I inovke my event handler from shortcut key (swapping Ctrl-V or assigning to some unused one), in addition to menu item?
The ExecuteGlobalAutoType method ensures that the KeePass database is open, searches for entries matching the current window (and lets the user select the appropriate one when there are multiple matches) and performs auto-type. KeePass calls the ExecuteGlobalAutoType method when the user presses the system-wide auto-type hot key.
If the target window is in the foreground and you already know the specific entry that you want to auto-type, you can use the AutoType.PerformIntoCurrentWindow method.
When you add a menu item to the KeePass main menu, you can specify the shortcut key using its ShortcutKeys property (and setting ShowShortcutKeys to true is a good idea, too, such that the user can see the shortcut key right of the menu item's name).
Thank you, Dominik. It worked! Great plug-in system:-)
I am sorry that I found that my approach have some other issue from functionality viewpoint. That means it is too early to publish anything. I hope I can publish something soon.