I'm trying to show a dialog over my Credential Provider tile. I call the OnCreatingWindow()
method (from CredentialProvider.Interop.dll
) which returns the HWND of the appropriate parent window. Before beeing able to use the handle in Form.Show(parentWindow), I need to convert the HWND handle into a NativeWindow implementing IWin32Window. This conversion does not work for me.
I've tried (where parentWndHandle is returned from OnCreatingWindow())
var nativeWindow = new NativeWindow();
nativeWindow.AssignHandle(parentWndHandle);
and
IWin32Window parent = NativeWindow.FromHandle(parentWndHandle);
and
IWin32Window parent = Control.FromHandle(parentWndHandle)
All of them return null
Expected result should be a NativeWindow to parent the dialog I want to show