Sunday, February 14, 2010 3:18 PMI've been looking around for a while now and can't seem to find anything. My application runs in the background and has a system tray icon, when the user clicks the system tray icon then a window will display. The problem is the main area for the application is using Hotkeys, so even when the application is hidden and still in the system tray if the user presses "Ctrl + Shift + D" for example then it will call a function in my application.I know how to do this in Win forms, but not WPF. When I've looked around all I could find is people just using using System.Windows.Forms;Any help is appreciated, thanks.
Tuesday, February 16, 2010 3:00 AMModeratorHi,
You need a little bit Win32 (like RegisterHotKey) and WPF interop to get this done.
I happen to have a sample which registers a hotkey (Win+C) and detects it no matter the application is in the background or not, then it can take further actions just like what you wanted.
You may want to take a look at the sample here:
Hope this helps.
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
If you have any feedback, please tell us.
The All-In-One Code Framework Project
My Blog (in Simplified Chinese)
- Marked As Answer by Banjo348 Tuesday, February 16, 2010 6:49 PM
Tuesday, February 16, 2010 6:50 PMWow thankyou so much!! I have been looking for ages to find a way to do this, I thought I was going to have to reference System.Windows.Forms :D