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. A big Q

A big Q

Scheduled Pinned Locked Moved C / C++ / MFC
performancequestion
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.
  • K Offline
    K Offline
    keyto
    wrote on last edited by
    #1

    I have a sample project and I have to implement this code into my project. I could not understand the theme of the code can you make me understand the code? The code goes like this void CDib::BmpLoad(CFile& rBmpFile) { int nCount, nSize; BITMAPFILEHEADER bmfh; nCount = rBmpFile.Read((LPVOID) &bmfh, sizeof(BITMAPFILEHEADER)); if(nCount != sizeof(BITMAPFILEHEADER)) { throw CDibException(CDibException::enm_file_read_filed, "BMPƒtƒ@ƒCƒ‹ƒTƒCƒY‚ªˆÙí‚Å‚·"); } // ƒtƒ@ƒCƒ‹ƒwƒbƒ_‚Ì'BM'‚ðŠm”F if(bmfh.bfType != 0x4d42) { throw CDibException(CDibException::enm_file_read_filed, "BMPƒtƒ@ƒCƒ‹‚ł͂ ‚è‚Ü‚¹‚ñ"); } nSize = bmfh.bfOffBits - sizeof(BITMAPFILEHEADER); m_pBmpHead = (LPBITMAPINFOHEADER) new BYTE[nSize]; nCount = rBmpFile.Read(m_pBmpHead, nSize); // info hdr & color table this->ComputeMetrics(); // BOOL ret; // m_pImage = (LPBYTE)VirtualAlloc(NULL,m_dwSizeImage,MEM_RESERVE|MEM_COMMIT,PAGE_READWRITE); // if(m_pImage == NULL) // VirtualAlloc(&m_pImage,m_dwSizeImage,MEM_COMMIT,PAGE_READWRITE); // MEMORY_BASIC_INFORMATION MemoryBasicInfo; // VirtualQuery(m_pImage,&MemoryBasicInfo,sizeof(MemoryBasicInfo)); // if(MemoryBasicInfo.State != MEM_COMMIT) // return; // ret =VirtualLock((LPVOID)m_pImage,m_dwSizeImage); m_pImage = (LPBYTE) new BYTE[m_dwSizeImage]; nCount = rBmpFile.Read(m_pImage, m_dwSizeImage); // image only // ret =VirtualUnlock((LPVOID)m_pImage,m_dwSizeImage); this->ComputePaletteSize(m_pBmpHead->biBitCount); this->MakePalette(); this->MakeDDB(); }

    C D H 3 Replies Last reply
    0
    • K keyto

      I have a sample project and I have to implement this code into my project. I could not understand the theme of the code can you make me understand the code? The code goes like this void CDib::BmpLoad(CFile& rBmpFile) { int nCount, nSize; BITMAPFILEHEADER bmfh; nCount = rBmpFile.Read((LPVOID) &bmfh, sizeof(BITMAPFILEHEADER)); if(nCount != sizeof(BITMAPFILEHEADER)) { throw CDibException(CDibException::enm_file_read_filed, "BMPƒtƒ@ƒCƒ‹ƒTƒCƒY‚ªˆÙí‚Å‚·"); } // ƒtƒ@ƒCƒ‹ƒwƒbƒ_‚Ì'BM'‚ðŠm”F if(bmfh.bfType != 0x4d42) { throw CDibException(CDibException::enm_file_read_filed, "BMPƒtƒ@ƒCƒ‹‚ł͂ ‚è‚Ü‚¹‚ñ"); } nSize = bmfh.bfOffBits - sizeof(BITMAPFILEHEADER); m_pBmpHead = (LPBITMAPINFOHEADER) new BYTE[nSize]; nCount = rBmpFile.Read(m_pBmpHead, nSize); // info hdr & color table this->ComputeMetrics(); // BOOL ret; // m_pImage = (LPBYTE)VirtualAlloc(NULL,m_dwSizeImage,MEM_RESERVE|MEM_COMMIT,PAGE_READWRITE); // if(m_pImage == NULL) // VirtualAlloc(&m_pImage,m_dwSizeImage,MEM_COMMIT,PAGE_READWRITE); // MEMORY_BASIC_INFORMATION MemoryBasicInfo; // VirtualQuery(m_pImage,&MemoryBasicInfo,sizeof(MemoryBasicInfo)); // if(MemoryBasicInfo.State != MEM_COMMIT) // return; // ret =VirtualLock((LPVOID)m_pImage,m_dwSizeImage); m_pImage = (LPBYTE) new BYTE[m_dwSizeImage]; nCount = rBmpFile.Read(m_pImage, m_dwSizeImage); // image only // ret =VirtualUnlock((LPVOID)m_pImage,m_dwSizeImage); this->ComputePaletteSize(m_pBmpHead->biBitCount); this->MakePalette(); this->MakeDDB(); }

      C Offline
      C Offline
      CPallini
      wrote on last edited by
      #2

      Jeff Prosise's book [^] may help. :)

      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.

      1 Reply Last reply
      0
      • K keyto

        I have a sample project and I have to implement this code into my project. I could not understand the theme of the code can you make me understand the code? The code goes like this void CDib::BmpLoad(CFile& rBmpFile) { int nCount, nSize; BITMAPFILEHEADER bmfh; nCount = rBmpFile.Read((LPVOID) &bmfh, sizeof(BITMAPFILEHEADER)); if(nCount != sizeof(BITMAPFILEHEADER)) { throw CDibException(CDibException::enm_file_read_filed, "BMPƒtƒ@ƒCƒ‹ƒTƒCƒY‚ªˆÙí‚Å‚·"); } // ƒtƒ@ƒCƒ‹ƒwƒbƒ_‚Ì'BM'‚ðŠm”F if(bmfh.bfType != 0x4d42) { throw CDibException(CDibException::enm_file_read_filed, "BMPƒtƒ@ƒCƒ‹‚ł͂ ‚è‚Ü‚¹‚ñ"); } nSize = bmfh.bfOffBits - sizeof(BITMAPFILEHEADER); m_pBmpHead = (LPBITMAPINFOHEADER) new BYTE[nSize]; nCount = rBmpFile.Read(m_pBmpHead, nSize); // info hdr & color table this->ComputeMetrics(); // BOOL ret; // m_pImage = (LPBYTE)VirtualAlloc(NULL,m_dwSizeImage,MEM_RESERVE|MEM_COMMIT,PAGE_READWRITE); // if(m_pImage == NULL) // VirtualAlloc(&m_pImage,m_dwSizeImage,MEM_COMMIT,PAGE_READWRITE); // MEMORY_BASIC_INFORMATION MemoryBasicInfo; // VirtualQuery(m_pImage,&MemoryBasicInfo,sizeof(MemoryBasicInfo)); // if(MemoryBasicInfo.State != MEM_COMMIT) // return; // ret =VirtualLock((LPVOID)m_pImage,m_dwSizeImage); m_pImage = (LPBYTE) new BYTE[m_dwSizeImage]; nCount = rBmpFile.Read(m_pImage, m_dwSizeImage); // image only // ret =VirtualUnlock((LPVOID)m_pImage,m_dwSizeImage); this->ComputePaletteSize(m_pBmpHead->biBitCount); this->MakePalette(); this->MakeDDB(); }

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

        keyto wrote:

        I could not understand the theme of the code can you make me understand the code?

        Exactly which statement is troubling you?


        "Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman

        "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

        1 Reply Last reply
        0
        • K keyto

          I have a sample project and I have to implement this code into my project. I could not understand the theme of the code can you make me understand the code? The code goes like this void CDib::BmpLoad(CFile& rBmpFile) { int nCount, nSize; BITMAPFILEHEADER bmfh; nCount = rBmpFile.Read((LPVOID) &bmfh, sizeof(BITMAPFILEHEADER)); if(nCount != sizeof(BITMAPFILEHEADER)) { throw CDibException(CDibException::enm_file_read_filed, "BMPƒtƒ@ƒCƒ‹ƒTƒCƒY‚ªˆÙí‚Å‚·"); } // ƒtƒ@ƒCƒ‹ƒwƒbƒ_‚Ì'BM'‚ðŠm”F if(bmfh.bfType != 0x4d42) { throw CDibException(CDibException::enm_file_read_filed, "BMPƒtƒ@ƒCƒ‹‚ł͂ ‚è‚Ü‚¹‚ñ"); } nSize = bmfh.bfOffBits - sizeof(BITMAPFILEHEADER); m_pBmpHead = (LPBITMAPINFOHEADER) new BYTE[nSize]; nCount = rBmpFile.Read(m_pBmpHead, nSize); // info hdr & color table this->ComputeMetrics(); // BOOL ret; // m_pImage = (LPBYTE)VirtualAlloc(NULL,m_dwSizeImage,MEM_RESERVE|MEM_COMMIT,PAGE_READWRITE); // if(m_pImage == NULL) // VirtualAlloc(&m_pImage,m_dwSizeImage,MEM_COMMIT,PAGE_READWRITE); // MEMORY_BASIC_INFORMATION MemoryBasicInfo; // VirtualQuery(m_pImage,&MemoryBasicInfo,sizeof(MemoryBasicInfo)); // if(MemoryBasicInfo.State != MEM_COMMIT) // return; // ret =VirtualLock((LPVOID)m_pImage,m_dwSizeImage); m_pImage = (LPBYTE) new BYTE[m_dwSizeImage]; nCount = rBmpFile.Read(m_pImage, m_dwSizeImage); // image only // ret =VirtualUnlock((LPVOID)m_pImage,m_dwSizeImage); this->ComputePaletteSize(m_pBmpHead->biBitCount); this->MakePalette(); this->MakeDDB(); }

          H Offline
          H Offline
          Hamid Taebi
          wrote on last edited by
          #4

          What do you want to know?

          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