Sending keypresses to a disabled webview2 #3939
Unanswered
doskabouter
asked this question in
Q&A
Replies: 3 comments
-
Did you find a solution? |
Beta Was this translation helpful? Give feedback.
0 replies
-
Unfortunately not... |
Beta Was this translation helpful? Give feedback.
0 replies
-
@doskabouter See: @champnic We need |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm trying to control a website through mouseclicks and sending keys to it, but that website should only get those events from my software, not from users clicking/typing into it.
So most of the time the webview is disabled, I only enable it (obviously) when I need to send a click or a key.
For mouseclicks I found a workable solution:
webView.Enabled = true;
webView.Focus();
Application.DoEvents();
Cursor.Position = new Point(x,y);
CursorHelper.DoLeftMouseClick();
webView.Parent.Focus();
webView.Enabled = false;
however for sending keys that is not working,
currently I have:
webView.Enabled = true;
Application.DoEvents();
webView.Focus();
Application.DoEvents();
sendKeys("aaab");
and after that I'm stuck.
If I add a webView.Enabled=false after the sendkeys (or with an extra Application.DoEvents();) it's too early and the keys won't get sent to the webView.
Tried catching the webView_Key* events but they never get fired.
Also tried overriding webView's wndProc, but the messages passing through there don't give me any hint on when the keys are sent/processed by the webView
Any ideas on how to make this possible?
Beta Was this translation helpful? Give feedback.
All reactions