A big Q
-
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(); }
-
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(); }
-
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(); }
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
-
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(); }
What do you want to know?