01-24-2009 10:02 PM
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
Solved! Go to Solution.
01-26-2009 01:44 PM - edited 01-26-2009 01:45 PM
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#.
01-26-2009 02:40 PM
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