Click here to Skip to main content
15,925,133 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: OnItemChanged runs several times! Pin
Mike Upton8-Apr-03 3:29
Mike Upton8-Apr-03 3:29 
GeneralRe: OnItemChanged runs several times! Pin
ns8-Apr-03 4:01
ns8-Apr-03 4:01 
GeneralRe: OnItemChanged runs several times! Pin
Mike Upton8-Apr-03 4:27
Mike Upton8-Apr-03 4:27 
GeneralRAS AutoDial Settings problem Pin
Mark Otway8-Apr-03 1:00
Mark Otway8-Apr-03 1:00 
GeneralBmp to jpg convertion Pin
Mahesh Varma8-Apr-03 0:49
Mahesh Varma8-Apr-03 0:49 
GeneralRe: Bmp to jpg convertion Pin
Anonymous8-Apr-03 1:40
Anonymous8-Apr-03 1:40 
GeneralRe: Bmp to jpg convertion Pin
Chris Losinger8-Apr-03 1:42
professionalChris Losinger8-Apr-03 1:42 
GeneralRe: Bmp to jpg convertion Pin
Dudi Avramov8-Apr-03 1:54
Dudi Avramov8-Apr-03 1:54 
Use GDI+ .
Take a sample from MSDN: "Setting JPEG Compression Level"

C++
#include <windows.h>
#include <gdiplus.h>
#include <stdio.h>
using namespace Gdiplus;

INT GetEncoderClsid(const WCHAR* format, CLSID* pClsid);  // helper function

INT main()
{
   // Initialize GDI+.
   GdiplusStartupInput gdiplusStartupInput;
   ULONG_PTR gdiplusToken;
   GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);

   CLSID             encoderClsid;
   EncoderParameters encoderParameters;
   ULONG             quality;
   Status            stat;

   // Get an image from the disk.
   Image* image = new Image(L"Shapes.bmp");

   // Get the CLSID of the JPEG encoder.
   GetEncoderClsid(L"image/jpeg", &encoderClsid);

   // Before we call Image::Save, we must initialize an
   // EncoderParameters object. The EncoderParameters object
   // has an array of EncoderParameter objects. In this
   // case, there is only one EncoderParameter object in the array.
   // The one EncoderParameter object has an array of values.
   // In this case, there is only one value (of type ULONG)
   // in the array. We will let this value vary from 0 to 100.

   encoderParameters.Count = 1;
   encoderParameters.Parameter[0].Guid = EncoderQuality;
   encoderParameters.Parameter[0].Type = EncoderParameterValueTypeLong;
   encoderParameters.Parameter[0].NumberOfValues = 1;

   // Save the image as a JPEG with quality level 0.
   quality = 0;
   encoderParameters.Parameter[0].Value = &quality;
   stat = image->Save(L"Shapes001.jpg", &encoderClsid, &encoderParameters);

   if(stat == Ok)
      wprintf(L"%s saved successfully.\n", L"Shapes001.jpg");
   else
      wprintf(L"%d  Attempt to save %s failed.\n", stat, L"Shapes001.jpg");

   // Save the image as a JPEG with quality level 50.
   quality = 50;
   encoderParameters.Parameter[0].Value = &quality;
   stat = image->Save(L"Shapes050.jpg", &encoderClsid, &encoderParameters);

   if(stat == Ok)
      wprintf(L"%s saved successfully.\n", L"Shapes050.jpg");
   else
      wprintf(L"%d  Attempt to save %s failed.\n", stat, L"Shapes050.jpg");

      // Save the image as a JPEG with quality level 100.
   quality = 100;
   encoderParameters.Parameter[0].Value = &quality;
   stat = image->Save(L"Shapes100.jpg", &encoderClsid, &encoderParameters);

   if(stat == Ok)
      wprintf(L"%s saved successfully.\n", L"Shapes100.jpg");
   else
      wprintf(L"%d  Attempt to save %s failed.\n", stat, L"Shapes100.jpg");

   delete image;
   GdiplusShutdown(gdiplusToken);
   return 0;
}

GeneralRe: Bmp to jpg convertion Pin
RaajaOfSelf9-Apr-03 13:08
RaajaOfSelf9-Apr-03 13:08 
GeneralList exported function in DLL Pin
AnTri8-Apr-03 0:22
AnTri8-Apr-03 0:22 
GeneralRe: List exported function in DLL Pin
vmaltsev8-Apr-03 5:06
vmaltsev8-Apr-03 5:06 
GeneralRe: List exported function in DLL Pin
AnTri8-Apr-03 11:04
AnTri8-Apr-03 11:04 
GeneralRe: List exported function in DLL Pin
Dudi Avramov8-Apr-03 23:04
Dudi Avramov8-Apr-03 23:04 
GeneralCListView Pin
rosen7-Apr-03 23:59
rosen7-Apr-03 23:59 
GeneralRe: CListView Pin
jhwurmbach8-Apr-03 0:16
jhwurmbach8-Apr-03 0:16 
Generalcontext mneu question Pin
Jump_Around7-Apr-03 23:50
Jump_Around7-Apr-03 23:50 
GeneralRe: context mneu question Pin
Brian Shifrin8-Apr-03 1:15
Brian Shifrin8-Apr-03 1:15 
GeneralRe: context mneu question Pin
Cedric Moonen8-Apr-03 1:19
Cedric Moonen8-Apr-03 1:19 
QuestionUnzipping? Pin
Brian Delahunty7-Apr-03 23:09
Brian Delahunty7-Apr-03 23:09 
AnswerRe: Unzipping? Pin
jhwurmbach7-Apr-03 23:27
jhwurmbach7-Apr-03 23:27 
GeneralScrollWindow Pin
jeremysay7-Apr-03 23:04
jeremysay7-Apr-03 23:04 
GeneralRe: ScrollWindow Pin
Brian Shifrin8-Apr-03 1:20
Brian Shifrin8-Apr-03 1:20 
GeneralRe: ScrollWindow Pin
jeremysay8-Apr-03 2:06
jeremysay8-Apr-03 2:06 
GeneralRe: ScrollWindow Pin
Brian Shifrin8-Apr-03 13:48
Brian Shifrin8-Apr-03 13:48 
GeneralRe: ScrollWindow Pin
jeremysay9-Apr-03 3:21
jeremysay9-Apr-03 3:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.