I tried new C# code. I succeed to get hard copy. But it occurred failure if I repeated. This phenomenon is I know. And if it was stopped data acquisition by c# code, it occurred failure anytime.
Code is below,
MessageBasedSession instrument;
bool running = false;
instrument = (MessageBasedSession)new ResourceManager().Open(VISA Address);
instrument.TimeoutMilliseconds = 500;
instrument.TerminationCharacterEnabled = true;
instrument.TerminationCharacter = 0x0A;
instrument.RawIO.Write("ACQ:STATE?\n");
if (instrument.RawIO.ReadString().Trim() == "1")
{
running = true;
instrument.RawIO.Write("ACQ:STATE STOP\n");
}
instrument.RawIO.Write("SAVEON:IMAG:FILEF PNG\n");
instrument.RawIO.Write("SAV:IMAG:COMP NORM\n");
instrument.RawIO.Write("SAV:IMAG \"C:/temp.png\"";*OPC?\n");
instrument.RawIO.ReadString();
osc.RawIO.Write("FILES:READF \"C:/temp.png\"\n");
Thread.Sleep(100);
instrument.TerminationCharacterEnabled = false;
File.WriteAllBytes("temp.png", instrument.RawIO.Read(2000000));
instrument.TerminationCharacterEnabled = true;
instrument.RawIO.Write("FILES:DELE \"C:/temp.png\"\n");
if (running) instrument.RawIO.Write("ACQ:STATE RUN\n");
instrument.Dispose();