Could anyone please help me convert this code to vb.net, I have tried it with the converters, but the compiler gives me errors:
HotKey hotkey = new HotKey((HwndSource)HwndSource.FromVisual(App.Current.MainWindow));
hotkey.Modifiers = HotKey.ModifierKeys.Alt | HotKey.ModifierKeys.Control;
hotkey.Key = System.Windows.Input.Key.V;
hotkey.HotKeyPressed += hotkey_HotKeyPressed;
It is from an excellent article on global hotkeys in WPF, it can be found here http://www.codeproject.com/Tips/274003/Global-Hotkeys-in-WPF, but it is in C# and my code is in vb.net.
I get this from the translator
Dim hotkey__1 As New HotKey(DirectCast(HwndSource.FromVisual(App.Current.MainWindow), HwndSource))
hotkey__1.Modifiers = HotKey.ModifierKeys.Alt Or HotKey.ModifierKeys.Control
hotkey__1.Key = System.Windows.Input.Key.V
hotkey__1.HotKeyPressed += hotkey_HotKeyPressed
The last line gives me an error that I should use a RaiseEvent. Could someone please give me hint on how to correctly convert it?
Many thanks!
From MSDN: