acess violation...
-
i cant figure out why theres an access violation below
WCHAR t[] = "image/bmp"; CLSID id; GetEncoderClsid(t, &id); Bitmap* bmp = 0; bmp->FromHBITMAP(hBmpFileBitmap,0); EncoderParameters encoderParameters; encoderParameters.Count = 1; encoderParameters.Parameter[0].Guid = EncoderQuality; encoderParameters.Parameter[0].Type = EncoderParameterValueTypeLong; encoderParameters.Parameter[0].NumberOfValues = 1; ULONG quality = 100; encoderParameters.Parameter[0].Value = &quality; bmp->Save(t2,&id,&encoderParameters); //access violation here
help would be appreciated thanks a bunch:) -
i cant figure out why theres an access violation below
WCHAR t[] = "image/bmp"; CLSID id; GetEncoderClsid(t, &id); Bitmap* bmp = 0; bmp->FromHBITMAP(hBmpFileBitmap,0); EncoderParameters encoderParameters; encoderParameters.Count = 1; encoderParameters.Parameter[0].Guid = EncoderQuality; encoderParameters.Parameter[0].Type = EncoderParameterValueTypeLong; encoderParameters.Parameter[0].NumberOfValues = 1; ULONG quality = 100; encoderParameters.Parameter[0].Value = &quality; bmp->Save(t2,&id,&encoderParameters); //access violation here
help would be appreciated thanks a bunch:)Tim Zorn wrote: bmp->Save(t2,&id,&encoderParameters); //access violation here What's t2 ? Also, the FromHBitmap method is static on the class, and RETURNS the Bitmap object. Your Bitmap is probably still NULL. Christian Graus - Microsoft MVP - C++ -- modified at 20:16 Thursday 15th September, 2005
-
Tim Zorn wrote: bmp->Save(t2,&id,&encoderParameters); //access violation here What's t2 ? Also, the FromHBitmap method is static on the class, and RETURNS the Bitmap object. Your Bitmap is probably still NULL. Christian Graus - Microsoft MVP - C++ -- modified at 20:16 Thursday 15th September, 2005
-
ok thanks. but now when it saves its the right size but blank. i think it has something to do with the pallette can u tell me what it is and how to make one? help would be appreciated thanks
Tim Zorn wrote: i think it has something to do with the pallette The fact that you're setting quality makes me thing you're saving a jpeg. Only greyscale jpegs have a pallete, and it's fixed ( because it's greyscale ). I'd break the process into steps. Load your image, then draw it on the screen. If it's OK there, then the problem is the saving code. Simplify that, and add stuff back in until it breaks. Christian Graus - Microsoft MVP - C++