ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

show vi inside .Net control

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

 

 

 

 

 

 

 

 

0 Kudos
Message 1 of 1
(2,876 Views)