SendKeys.Send Method in WPF application

前端 未结 2 756
独厮守ぢ
独厮守ぢ 2020-12-06 00:05

I\'m trying to send Keystroke(Ctrl+T) for browser control. But, SendKeys.Send() showed error in WPF application?? My question is

1) Can I use this metho

2条回答
  •  [愿得一人]
    2020-12-06 01:08

    SendKeys is part of the System.Windows.Forms Namespace there is not an equivalent method in Wpf. You can not use the SendKeys.Send with WPF but you can use the SendKeys.SendWait method, if you add System.Windows.Forms to your project references. Your only other option would be to to PInvoke SendInput.

    Be aware that both of these methods send data to the currently active window.

提交回复
热议问题