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. Problem in loading Image,GetLastError 33

Problem in loading Image,GetLastError 33

Scheduled Pinned Locked Moved C / C++ / MFC
helpalgorithms
4 Posts 4 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.
  • H Offline
    H Offline
    hemlat
    wrote on last edited by
    #1

    Hi, I am loading JPG images using follwing code.

    image.Load(Image);
    HBITMAP hbmp = image.Detach();
    if(hbmp == NULL)
    {
    Error = GetLastError();
    }

    Load function is failing and I am getting error code 33. I am searching in google.But I am not getting any useful information. can anyone help me.

    CPalliniC M D 3 Replies Last reply
    0
    • H hemlat

      Hi, I am loading JPG images using follwing code.

      image.Load(Image);
      HBITMAP hbmp = image.Detach();
      if(hbmp == NULL)
      {
      Error = GetLastError();
      }

      Load function is failing and I am getting error code 33. I am searching in google.But I am not getting any useful information. can anyone help me.

      CPalliniC Online
      CPalliniC Online
      CPallini
      wrote on last edited by
      #2

      From WinError.h:

      // // MessageId: ERROR_LOCK_VIOLATION // // MessageText: // // The process cannot access the file because another process has locked a portion of the file. // #define ERROR_LOCK_VIOLATION 33L

      :)

      If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
      This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
      [My articles]

      In testa che avete, signor di Ceprano?

      1 Reply Last reply
      0
      • H hemlat

        Hi, I am loading JPG images using follwing code.

        image.Load(Image);
        HBITMAP hbmp = image.Detach();
        if(hbmp == NULL)
        {
        Error = GetLastError();
        }

        Load function is failing and I am getting error code 33. I am searching in google.But I am not getting any useful information. can anyone help me.

        M Offline
        M Offline
        Michael Schubert
        wrote on last edited by
        #3

        In order to get the actual message from the OS you may use FormatMessage() Something like:

        DWORD dwError = ::GetLastError();
        LPTSTR lpBuffer;
        CString csErrorMsg;

        if (::FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER, NULL, dwError,
        MAKELANGID(LANG_NEUTRAL, SUBLANG_SYS_DEFAULT), (LPTSTR)&lpBuffer, 0, NULL) != 0)
        {
        csErrorMsg.Format("%s", lpBuffer); //csErrorMsg contains the message
        }

        1 Reply Last reply
        0
        • H hemlat

          Hi, I am loading JPG images using follwing code.

          image.Load(Image);
          HBITMAP hbmp = image.Detach();
          if(hbmp == NULL)
          {
          Error = GetLastError();
          }

          Load function is failing and I am getting error code 33. I am searching in google.But I am not getting any useful information. can anyone help me.

          D Offline
          D Offline
          David Crow
          wrote on last edited by
          #4

          hemlat wrote:

          Load function is failing and I am getting error code 33.

          If Load() is failing, you should be calling GetLastError() after it, not Detach().

          "Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown

          "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

          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