BNC 645 User Manual
Page 190
190
USB::5710::
4002::tw00000001\n\n");
//Initialize
COM
CoInitialize(NULL);
//Create the BERKELEY NUCLEONICS CORPORATION IOUtils component
hr = CoCreateInstance(CLSID_BERKELEY NUCLEONICS
CORPORATIONIOUtils,NULL,CLSCTX_INPROC_SERVER,IID_IOUtils
,(LPVOID *)&IIO);
if
FAILED(hr)
{
printf("CoCreateInstance
failed\n");
return
0;
}
Continued on next page
//Connect
String
myInstrument="USB::5710::
4002::tw00000001";
IIO->Connect(_bstr_t(myInstrument));
IIO->Address(&bstr);
printf("%s\n",(char
*)_bstr_t(bstr));
IIO->Output(_bstr_t("*IDN?\n"));
IIO->Input
(&bstr);
printf("%s\n",(char
*)_bstr_t(bstr));
IIO->Output(_bstr_t("READ?\n"));
IIO->Input
(&bstr);
printf("%s\n",(char
*)_bstr_t(bstr));
IIO->Close();
IIO->Release();
//Uninit so COM is exited clean.
CoUninitialize();
return
0;
}