HResult INiIsolationClient.PreProcessMessage(ref NiMessage message, out PreProcessMessageResult preProcessMessageResult) { preProcessMessageResult = 0; try { var result = HResult.False; var target = FindTarget(message.HWnd); if (target != null) { Message msg = message; result = target.PreProcessMessage(ref msg) ? HResult.OK : HResult.False; message = msg; if (ControlStubs.ControlGetState2(target, ControlStubs.STATE2_INPUTKEY)) { preProcessMessageResult |= PreProcessMessageResult.IsInputKey; } if (ControlStubs.ControlGetState2(target, ControlStubs.STATE2_INPUTCHAR)) { preProcessMessageResult |= PreProcessMessageResult.IsInputChar; } } return(result); } catch (Exception ex) { return(ErrorUtil.GetHResult(ex)); } }
protected override void Select(bool directed, bool forward) { if (_select > 0) { return; } _select++; try { // We were the target of select next control. Forward the // call to the isolation client which does its search. If it // matches a control, we need to make ourselves active. if (ErrorUtil.ThrowOnFailure(_window.SelectNextControl(!directed || forward))) { base.Select(directed, forward); return; } // If the client wasn't able to select something, we continue the // search from here. One small detail is that SelectNextControl // does not match itself. When it would match an IsolationClient, // this would mean that the search does not go into the // IsolationHost. We specifically match this case by first doing // a non-wrapping search and matching the root for IsolationClient. // If that matches, we allow the IsolationClient to continue // the search upwards. Otherwise, we continue the search // from the root as usual. var root = ControlUtil.GetRoot(this); if (root.SelectNextControl(this, !directed || forward, true, true, !(root is NiIsolationClient))) { return; } if (root is NiIsolationClient) { ControlStubs.ControlSelect(root, directed, forward); } } finally { _select--; } }
public override bool PreProcessMessage(ref Message msg) { NiMessage message = msg; PreProcessMessageResult preProcessMessageResult; bool processed = ErrorUtil.ThrowOnFailure(_window.PreProcessMessage(ref message, out preProcessMessageResult)); msg = message; ControlStubs.ControlSetState2( this, ControlStubs.STATE2_INPUTKEY, (preProcessMessageResult & PreProcessMessageResult.IsInputKey) != 0 ); ControlStubs.ControlSetState2( this, ControlStubs.STATE2_INPUTCHAR, (preProcessMessageResult & PreProcessMessageResult.IsInputChar) != 0 ); return(processed); }
HResult INiIsolationClient.PreviewKeyDown(Keys keyData) { try { var result = HResult.False; var target = FindTarget(NativeMethods.GetFocus()); if (target != null) { var e = new PreviewKeyDownEventArgs(keyData); ControlStubs.ControlOnPreviewKeyDown(target, e); result = e.IsInputKey ? HResult.OK : HResult.False; } return(result); } catch (Exception ex) { return(ErrorUtil.GetHResult(ex)); } }