ユーザーがキーボードから入力している文字にコードがアクセスする必要がある MS-Word アドオンを開発しています。
private void ThisDocument_Startup(object sender, System.EventArgs e)
{
this.SelectionChange += new SelectionEventHandler(ThisDocument_SelectionChange);
}
void ThisDocument_SelectionChange(object sender, SelectionEventArgs e)
{
MessageBox.Show(e.Selection.Text);
}
SelectionChange イベントでテキストを取得できると思いますが、キーを押したときにイベントが発生しません。キーを押したときにイベントをトリガーする方法はありますか? また、それを行うためのより簡単な方法や、機能を提供するオープンソース プロジェクトがあれば、それは大歓迎です。