HP (Hewlett-Packard) Drive Network Card User Manual


 
Using IVI with Visual C++
19
“$(VXIPNPPATH)VisaCom”
Note:
These steps need only be done once for each computer you use. All
subsequent Visual Studio projects will continue to use these settings and will be
able to locate your IVI-COM drivers.
6 Click OK
7 To import the type libraries, type the following statements following the header
file reference:
#import “IviDriverTypeLib.dll” no_namespace
#import “IviDmmTypeLib.dll” no_namespace
#import “GlobMgr.dll” no_namespace
#import “Agilent34401.dll” no_namespace
Note:
The
import
statements access the driver type libraries used by the Agilent
34401 DMM. The no_namespace attribute allows the code to access the interfaces
in the typelibraries from the global namespace.
Initialize COM
1 To initialize the COM library, type the following lines after the { following the int
statement:
HRESULT hr;
hr = CoInitialize(NULL);
IF(FAILED(hr))
exit(1);
Note
:
Including error handling in your programs is good practice. This code
checks for errors in your program.
2 To close the COM library before exiting, type the following line at the end of
your code, right before the return line:
CoUninitialize();
Create an Instance of the Driver
To create an instance of the driver, type
IIviDmmPtr dmm(__uuidof(Agilent34401));
Note:
This creates a smart pointer that provides easy access to the COM object.
You are now ready to write the program to control the simulated instrument.