Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. acess violation...

acess violation...

Scheduled Pinned Locked Moved C / C++ / MFC
graphicshelp
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    Tim Zorn
    wrote on last edited by
    #1

    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:)

    C 1 Reply Last reply
    0
    • T Tim Zorn

      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:)

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      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

      T 1 Reply Last reply
      0
      • C Christian Graus

        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

        T Offline
        T Offline
        Tim Zorn
        wrote on last edited by
        #3

        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

        C 1 Reply Last reply
        0
        • T Tim Zorn

          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

          C Offline
          C Offline
          Christian Graus
          wrote on last edited by
          #4

          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++

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups