User Hotkey Capture / Registration

jeudi 26 novembre 2015

I am attempting to write a teamspeak plugin using the SDK using C# and Visual Studio.

The first part of the process was to develop the user interface, which is nearly complete. I am sure the next part, integration with ts, will be harder, but am nonetheless stuck with the UI.

My user is to register three hotkeys with windows using the windows api user32.dll as set out below.

[DllImport("user32.dll")]
private static extern bool RegisterHotKey(IntPtr hWnd, int id, uint fsModifiers, uint vk);

I have tried to replicate the ui in the ts client Setting/Options/Push to Talk button, with a button that when pressed launches a gray box and a listener, which stores the keys pressed and then repeats inside the button.text.

To achieve this I am using the KeyPress event which delivers KeyPressEventArgs. This looks first for the modifiers (SHF/ALT/CTRL/WIN) and then the key.

THIS ALL WORKS FINE WITH SHF, BUT GIVES NO KEY WITH THE OTHER MODIFIERS.

I wonder if someone familiar with the ts client source could tell me which of the windows procedures they use for hotkey capture. I am currently just logging away with protected override bool ProcessCmdKey(ref Message msg, Keys keyData) and protected override void WndProc(ref Message keyPressed) to see from the log files if I can identify the logic to use to achieve the goal. As I perform this mindless work, it occurred to me to ask you all for a pointer. It cannot be that hard!!

Many thanks

Durham
User Hotkey Capture / Registration

0 commentaires:

Enregistrer un commentaire