Ok, i figured it out. Here is the result:
int WS_CHILD = 0x40000000;
int WS_VISIBLE = 0x10000000;
// paint wpf on int hParentWnd
myWindow = new MyWpfWindow();
// First it creates an HwndSource, whose parameters are similar to CreateWindow:
HwndSource otxHwndSource = new HwndSource(
0, // class style
WS_VISIBLE | WS_CHILD, // style
0, // exstyle
10, 10, 200, 400,
"MyWpfWindow", // NAME
(IntPtr)hParentWnd // parent window
);
otxHwndSource.RootVisual = ...;
// following must be set to prcess key events
myHwndSource.AddHook(new HwndSourceHook(ChildHwndSourceHook));
with the hook:
private IntPtr ChildHwndSourceHook(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
{
if (msg == (int)(0x0087)) //WM_GETDLGCODE
{
handled = true;
int returnCode = (int)(0x0080);
return new IntPtr(returnCode);
}
return System.IntPtr.Zero;
}
thanks to Ray Burns!