HP Drive Manual do Utilizador Página 21

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
  • Página
    / 114
  • Índice
  • MARCADORES
  • Avaliado. / 5. Com base em avaliações de clientes
Vista de página 20
Using IVI with Visual C++
21
Set the Reading Timeout/Display the Reading
Create a variable to represent the reading and make a reading with a timeout of 1
second (1000 milliseconds).
1 Type
double reading = dmm->Measurement->Read(1000);
2 To display the reading, use printf. Type
wprintf(L“Reading: %g\n”, reading);
Error Checking
To catch errors in the code, activate error checking.
1 Surround the preceding statements with a try block. Add the following lines as
shown in the illustration above:
try {
}
2 Process errors in a catch block. Type
catch (_com_error e) {
wprintf(L“Error: %s”, e.ErrorMessage());
}
Close the Session
To close out the instance of the driver and free resources, type
dmm->Close();
The final code should look like the following:
#include "stdafx.h"
#import "IviDriverTypeLib.dll" no_namespace
#import "IviDmmTypeLib.dll" no_namespace
#import "GlobMgr.dll" no_namespace
#import "Agilent34401.dll" no_namespace
int IVI_Demo()
{
HRESULT hr;
hr = CoInitialize(NULL);
if(FAILED(hr))
Vista de página 20
1 2 ... 16 17 18 19 20 21 22 23 24 25 26 ... 113 114

Comentários a estes Manuais

Sem comentários