Okay, if the form is a xaml file then it is WPF.
Process.GetCurrentProcess().MainWindowHandle is an
IntPtr but your code does not show the definition of
Hwnd. That is probably not important to the problem but I am not sure.
parameters? What type is it? a
HwndSource can be created using a
System.Windows.Interop.HwndSourceParameters but they do not have a
view? I see no declaration of it.
Note that the code you show here does not use
src. So most of the code is not relevant.
Do you know what the value of
Also, you do not tell us where the code is at in the application. If the code executes before the main window is created then of course there is no handle.