01-04-2016 07:07 AM - edited 01-04-2016 07:27 AM
Hi,
I made an example to test .net docking libraries to use inside a Labview .Net control Test of .NET docking libraries to use with Labview .
To show a vi inside a .net control I call the Windows API functions:
_previousParentWindow=SetParent(_viHandle, this.Handle); // Make the VI a child of the control
and in the Resize eventhandler
MoveWindow(_viHandle, 0, 0, this.Width, this.Height, true);
ShowWindow(_viHandle, Hide);
ShowWindow(_viHandle, ShowDefault);
And in the Dispose method I restore the parent and send a WM_CLOSE Message to end the vi execution.
SetParent(_viHandle, _previousParentWindow);
SendMessage(_viHandle, WM_CLOSE , IntPtr.Zero, IntPtr.Zero);
This works, if I call Dispose of the Docking class inside the .net Control.
If Labview is closed and Dispose is not called, then Labview crashed or sometimes it run only as process without a window.
Is this the correct way to include a vi window inside a .Net control? Or exists a better solution?
Best regards,
Peter