winapi - WPF HwndHost keyboard focus -


The chart area in the screenshot is a HWOS control, which hosts a native Win32 window (with its own registered WNDCLASS) implemented in C ++. HwndHost pulled with

The problem I have is that I can not set the keyboard focus in the host Win32 window. I want to focus on moving the clicks used on the chart area to the hosted Win32 window. I tried to call Setfocus on WM_LBUTTONDOWN, but screwing the focus in the rest.

Currently, even if I click on the Win32 window, the focus stays on the tree view on the left, and if I press the cursor key up / down, then tree view They will get them, not from the chart window.

How do I get the hosted Win32 window from the keyboard input when the user clicks the chart area, unless it is clicked on another control (like tree view or toolbar) is?

Edit: The C ++ / CLI code for the window host is:

  template & lt; Typename T & gt; Inline T IntPtr Value {Return reinterpret_cast & lt; T & gt; (Static_cast & lt; void * & gt; (value)); } Public Referee Class ChartwondoHost: Public HDDHOST, IKEboardInputSync {Private: ChartDown * ChartWindows; // This is a C ++ class that preserves the real work: Virtual Handler Buildwandor (HandlerParent) Override {chartWindow = New Chart Window; Consteistance H Instance = InTTPTTR & lt; Hitstones & gt; (Marshall :: Gatisfence (Assembly :: GetExecutingAssembly () - & gt; GetModules () [0])); Const HWND mother tongue = intPtrToPtr & lt; Hwnd & gt; (Parent.handle); ChartWindow- & gt; Create (hInstance, parentWindow); Return HandleRef (this, IntPtr (chartwindow-> GetHandle ()); } Delete Virtual Zodiac WindowCore (HandleRef / * window * /) Override {chartWindow- & gt; Destroyed (); Delete chart; ChartWindow = NULL; }};  

well, something about WndProc () on the HDDHost subclass ...


Comments