I am attempting to use the sample code for the Agilent U2701A/U2702A USB Modular Oscilloscopes, IVI-COM Programmer's Reference for Visual C++ .Net. I have found the ResourceName using the Agilent Connection Expert. The mentioned DLLs are in C:\Program Files\IVI\bin. I am using Visual Studio 2008.
My program compiles with the following setup:
#include "stdafx.h"
#import "IviDriverTypeLib.dll" no_namespace
#import "IviScopeTypeLib.dll" no_namespace
#import "AgU2701A.dll" no_namespace
using namespace System;
using namespace System::IO;
When I execute the statement:
Driver->Initialize("USB0::0x0957::0x2918::MY50361023::0::INSTR", true, true, "");
An exception is thrown:
First-chance exception at 0x7c812afb in U2701A_Test.exe: Microsoft C++ exception: _com_error at memory location 0x0012f214..
A first chance exception of type 'System.Runtime.InteropServices.SEHException' occurred in U2701A_Test.exe
My prime candidate is an entry somewher in the project or solution, but I can not find it. It is my operating premise that I do not need .h files when I use a #using.
My program compiles with the following setup:
#include "stdafx.h"
#import "IviDriverTypeLib.dll" no_namespace
#import "IviScopeTypeLib.dll" no_namespace
#import "AgU2701A.dll" no_namespace
using namespace System;
using namespace System::IO;
When I execute the statement:
Driver->Initialize("USB0::0x0957::0x2918::MY50361023::0::INSTR", true, true, "");
An exception is thrown:
First-chance exception at 0x7c812afb in U2701A_Test.exe: Microsoft C++ exception: _com_error at memory location 0x0012f214..
A first chance exception of type 'System.Runtime.InteropServices.SEHException' occurred in U2701A_Test.exe
My prime candidate is an entry somewher in the project or solution, but I can not find it. It is my operating premise that I do not need .h files when I use a #using.
I am having the same problem in C#. The sample C# code for the U2701A works fine, but it is in simulation mode:
When I change the code to have an empty last parameter, as it shows on page 196 of the IVI-COM C# Programmer's Reference, I get an exception like JoeS:
I have verified through the Agilent software that I am able to access the device and read data, so it isn't a driver issue. I can also read in the driver information when I have the "Simulate=true" option set, which shows me that my C# app can access the driver as well.
In Visual Studio 2010 the exception says "Object reference not set to an instance of an object".
Any ideas?