A number of properties and methods implemented in Fore assemblies use the IWin32Window type. This type describes various platform windows. .NET forms cannot be used as values when using these methods or properties in Fore.NET, as .NET forms are described by the System.Windows.Forms.IWin32Window interface, which cannot be explicitly cast to the Fore.NET equivalent of the interface of IWin32Window - Prognoz.Platform.Interop.Forms.IWin32Window.
To resolve the specified problem, the IWin32WindowForeAdapter class was implemented, which implements the Prognoz.Platform.Interop.Forms.IWin32Window interface. The constructor of this class has a single input parameter of the System.Windows.Forms.IWin32Window type. When an instance of the specified class object is created, it is converted to the required Prognoz.Platform.Interop.Forms.IWin32Window type specified as a window parameter. The created object instance can be used as a parameter in properties and methods using the Prognoz.Platform.Interop.Forms.IWin32Window type.
Executing the example requires a .NET form and a button on it. A system assembly of the Ui platform is connected in the corresponding .NET assembly.
Private Sub button1_Click(sender: System.Object; e: System.EventArgs);
Var
WinApp: WinApplicationClassClass = New WinApplicationClassClass();
Begin
WinApp.InformationBox("Using IWin32Window", New IWin32WindowForeAdapter(Self));
End Sub;
Clicking the button will show the specified information message. The message box opens modally relative to the current .NET form.
See also: