Some properties and methods implemented Fore assemblies use the IWin32Window type. This type describes various platform windows. When these methods or properties are used in Fore.NET, .NET forms cannot be used as values because .NET forms are described by the System.Windows.Forms.IWin32Window interface which cannot be explicitly cast to the Fore.NET equivalent of the IWin32Window interface, that is, Prognoz.Platform.Interop.Forms.IWin32Window.
To resolve the specified problem, the IWin32WindowForeAdapter special 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. The Ui platform system assembly 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 displays the specified information message. The message box opens modally relative to the current .NET form.
See also: