03-30-2015 10:59 AM
Anyone have any luck with using Switch Executive through Visual Studio/Measurement Studio? Can't find any class libraries like there is with other NI devices (DMM, SCOPE, etc) on NI's site. I tried to use the IVI Instrument wizard through Measurement Studio but it doesn't even convert it to something that is able to be compiled... it tries to PInvoke on niSE_32.dll which doesn't even exist on my system with NISE 3.6 installed. I finally wrote a DLL in CVI where I wrap Switch Executive's API into something I can manually PInvoke from C#, but that seems like a roundabout way to do it.....
03-31-2015
03:07 PM
- last edited on
11-19-2025
10:04 AM
by
Content Cleaner
Hi taft220,
Unfortunately it does not look like we have any .NET libraries for Switch Executive. I believe that Switch Executive only has C dlls available, based on the note in this document: https://download.ni.com/support/switchexecutive/Eval/Documentation/Getting%20Started%20with%20NI%20S...
Its sounds like the way you have found to get around this issue is in fact the likely workaround.
04-12-2017 01:14 PM
Hi taft220,
I am using C# as well and was curious if you would share your PInvoke wrapper of the Switch Executive API's?
Example of niSwitch_init function
[DllImport("niSwitch_32.dll", EntryPoint = "niSwitch_init", CallingConvention = CallingConvention.StdCall)]
public extern static int init(string Resource_Name, ushort ID_Query, ushort Reset_Device, ref System.IntPtr Instrument_Handle);
Thanks,
AG
04-13-2017
04:20 PM
- last edited on
11-19-2025
10:05 AM
by
Content Cleaner
Hi AG,
taft220 might not be watching this post anymore since it is a couple of years old. I found some links that indicate you should be able to use Switch Executive with Measurement Studio, including the below white paper.
The below example may be helpful to you. The link is unfortunately broken, but I have reported it and hopefully it will be fixed soon. However, the example program is able to be downloaded.
http://www.ni.com/example/26648/en/