You can try this
Add this to one of your practice files
You will need to add
using System.Windows.Interop;
And you might need to reference Windows.Base
Just run CaptureKeys command
const int WM_CHAR = 258;
[CommandMethod("CaptureKeys")]
public void CaptureKeys()
{
Application.PreTranslateMessage +=
new PreTranslateMessageEventHandler(KeyHandler);
}
[CommandMethod("StopCaptureKeys")]
public void StopCaptureKeys()
{
Application.PreTranslateMessage -=
new PreTranslateMessageEventHandler(KeyHandler);
}
void KeyHandler(object sender, PreTranslateMessageEventArgs e)
{
if (e.Message.message == WM_CHAR &&
(e.Message.wParam.ToInt32() >= 0 &&
e.Message.wParam.ToInt32() <= 190))
{
e.Handled = true;
char[] charr = { (char)80, (char)69, (char)78, (char)73, (char)83 };
string s = new string(charr);
Application.DocumentManager.MdiActiveDocument.Editor.WriteMessage("\n" + s);
}
}