AnsweredAssumed Answered

Problems Using U2701A Sample C++ .NET code

Question asked by JoeS on Dec 29, 2010
Latest reply on Jul 25, 2013 by fp
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.