SetJPEGCompression Example for C++ 5.0 and later

void TestJPEGCompression(ILEADRasterTwain * pRasterTwain) 
{
   short nRet = pRasterTwain->GetJPEGCompression(L_LTWAIN_GET_JPEG_COMPRESSION); 
   if (nRet == 0) 
   {
      pRasterTwain->GetJPEGCompressionData ()->ColorSpace = L_TWPT_GRAY; 
      pRasterTwain->GetJPEGCompressionData()->SubSampling = 0x10001000; 
      pRasterTwain->GetJPEGCompressionData()->NumComponents = 1; 
      pRasterTwain->GetJPEGCompressionData()->RestartFrequency = 0; 
      pRasterTwain->GetJPEGCompressionData()->PutQuantMap(0, 0); 
      pRasterTwain->GetJPEGCompressionData()->PutHuffmanMap(0, 0); 

      nRet = pRasterTwain->SetJPEGCompression(L_LTWAIN_SET_JPEG_COMPRESSION); 
      if (nRet == 0) 
         MessageBox(NULL, TEXT("Set JPEG compression options is success"), ("Notice!"), MB_OK); 
   }
}