If I create an HwndSource
directly, have I then also created a WPF Window
that I can now access from code? If so, how can I access it?
Or do I now need to somehow "add" a WPF Window
to that HwndSource
? If so, how do I do this?
I have studied the HwndSource
documentation thoroughly, and this part is not explained well at all. I understand that I can get the HwndSource
from an existing WPF Window, but that does not help me. I need to intercept the creation of the Window
, so I can force it to WS_CHILD
style and set its parent directly; and the docs say you must create the HwndSource directly if you want to force its parent.
Edit: I've been studying every question I can find with HwndSource
in it; it looks like you "add" the WPF object to the HwndSource
object by setting the RootVisual
property of the HwndSource
object to the WPF object you want displayed; or maybe by calling the HwndSource
AddSource
method? Will examine those next. Hope this is useful to other questioners.