22
Chapter 2
•
•
•
•
•
•
exit(1);
{
IAgilent34401Ptr dmm(__uuidof(Agilent34401));
try{
dmm->Initialize("GPIB::23",false,true,"simulate=true");
dmm->DCVoltage->Configure(1.5, 0.001);
dmm->Trigger->Delay = 0.01;
double reading = dmm->Measurement->Read(1000);
wprintf(L“Reading: %g\n”, reading);
}
catch(_com_error e){
wprintf(L“Error: %s\n”, e.ErrorMessage);
}
dmm->Close();
}
CoUninitialize();
return 0;
}
Build and Run the Application
Build your application and run it to verify it works properly.
1 From the Start Menu, select Build, and click Build IVIDemo.
2 From the Start Menu, select Debug, and run the application.
Using IVI-C in Visual C++
The following sections show to get started with IVI-C in Visual C++.
Create a New Project and Import the Driver Type Libraries
To use an IVI-C Driver in a Visual C++ program, you must provide paths to the
header files and libraries it uses.
1 Launch Visual Studio 2005 and create a Win32 Console Application in C++
with the name IVI demo.
Note:
The program already includes some required code, including the header file
#include stdafx.h
.