ImageEffects Example for C++ 5.0 and later

void TestTwainImageEfx(HWND hWnd)
{
   ILEADRasterTwain * pRasterTwain;

   HRESULT hr = ::CoCreateInstance(CLSID_LEADRasterTwain, NULL, CLSCTX_ALL, IID_ILEADRasterTwain, (void **)&pRasterTwain);
   if (FAILED(hr) || !pRasterTwain)
   {
      ::MessageBox (NULL, _TEXT("Failed to create a Raster Twain Object"), _TEXT("Error"), MB_OK);
      return;
   }

   pRasterTwain->EnableMethodErrors = FALSE;
   pRasterTwain->InitSession((long)hWnd);

   pRasterTwain->GetProperties();

   pRasterTwain->ImageEffects->PixelFlavor = L_TWPF_VANILLA;
   pRasterTwain->ImageEffects->ColorScheme = L_TWPT_BW;
   pRasterTwain->ImageEffects->HighLight = 50;
   pRasterTwain->ImageEffects->Shadow = 50;
   pRasterTwain->ImageEffects->Brightness = 500;
   pRasterTwain->ImageEffects->Contrast = 100;

   char buf[256];
   memset(buf, 0, strlen(buf));
   wsprintf(buf, TEXT("Current used Halftone = %d"), pRasterTwain->ImageEffects->HalfTone);
   ::MessageBox(NULL, buf, "Halftone", MB_OK);

   pRasterTwain->SetProperties();
   pRasterTwain->EndSession();
}