Quantcast
Channel: Measurement Studio for VC++ topics
Viewing all articles
Browse latest Browse all 654

Error to use Dispose API of NI-VISA in C++

$
0
0

Hi,

I installed NI-VISA v18.00. and tried to create power supply control program in C++.

Refer to example code from NI-VISA  "Examples\.NET\17.5\SimpleReadWrite"

I could send USB command to control Keithley power-supply 2230G  properly. 

but when I would like to close the connected session. the compiler show the error message as below :

error C2039: 'Dispose' : is not a member of 'NationalInstruments::Visa::MessageBasedSession'

Does anyone have idea about this?  Thanks

Operation System : Win10 x64 VS2013

//my sample code

MessageBasedSession^ mbSession;

NationalInstruments::Visa::ResourceManager^ rmSession = gcnew ResourceManager();

 

strResource = rmSession->Find("USB?*0x2230?*INSTR");
for each (System:Smiley Frustratedtring^ strCom in strResource)
{
resourceID = strCom;
}
try {
     mbSession = (NationalInstruments::Visa::MessageBasedSession^)rmSession->Open(resourceID);

}
catch (...) {
}
try {
     mbSession->RawIO->Write("OUTP ON");
     Sleep(500);
}
catch (...) {
}
    Sleep(1000); //wait for Power supply stable
    mbSession->Dispose();  //compile error

 


Viewing all articles
Browse latest Browse all 654

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>