LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

RunUserInterface in C#

Solved!
Go to solution

I realize this might be an odd ball question but I'm curious to see if there is a way to do this.

 

I have a small library of tools compiled to DLLs that are loaded as "plugins" in several other of my applications.  These DLLs load their own panels, have event callbacks etc. They all work wonderfully when loaded into a CVI application that has a RunUserInterface() or other CVI event processing loop.

 

Now comes the question.  I have a C# application in which I'd like to use one of the plugin dlls.  I can call the DLL functions from C# and the panels are loaded and the CVIRTE is loaded, but how do I/can I process events to the plugin's loaded panels? or start a RunUserInterface thread that will get event messages and call the panel callbacks? 

 

Greg 

0 Kudos
Message 1 of 3
(3,478 Views)

Hi Greg,

 

There is a Developer Zone article here that should be helpful: http://zone.ni.com/devzone/cda/tut/p/id/3452 .  This document details how to get CVI code working in Visual C++.  The process for getting this working in C# will be identical except for the final code written in C#.  I've attached an example that was built using an On/Off example in CVI that is called with a C# project.  The C# code just runs a function that initializes the UI and CVI handles all of the callbacks.

 

If you need to do some communication between the panel and your C# code, it might be a little more tricky, but this should let you run a CVI panel that does some operations inside of C#.

Message Edited by Eric B. on 01-26-2009 01:45 PM
Eric B.
National Instruments
Message 2 of 3
(3,447 Views)
Solution
Accepted by topic author gvan

I've found my prevous mistake.  I can spawn a thread from C# to Init my DLL and then make a call to RunUserInterface and all is well.

 

Greg 

 

0 Kudos
Message 3 of 3
(3,441 Views)