AnsweredAssumed Answered

Problem with ReadFullWaveform

Question asked by pangolin on Nov 26, 2012

i'm trying to code something in C that saves the full waveform from my U2702A oscilloscope automatically in a file.

This is the Code i'm using:

#include "stdafx.h"
#import "IviDriverTypeLib.dll" no_namespace
#import "IviScopeTypeLib.dll" no_namespace
#import "AgU2701A.dll" no_namespace

int main()
     HRESULT hr = CoInitialize(NULL);
     if(!SUCCEEDED(hr)) {return 1;}
     // Create an instance of the driver
     IAgilentU2701APtr Driver(__uuidof(AgilentU2701A));
     // ReadFullWaveform Statement
     SAFEARRAY *Data = NULL;
     long Length = 0;
     long *pLength = &Length;
     // Create SafeArray
     Data = ::SafeArrayCreateVector(VT_ARRAY,0,0);
     Driver->Measurements->GetItem("Channel1")->ReadFullWaveform(&Data, pLength);
     // Destroy SafeArray for freeing memory

When I run the programm i always get an exception in agu2701a.tli , but i cant find the reason.
Any ideas? I've attached a screenshot of the exception.

Greetings Pangolin