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
S

Snillet2k

@Snillet2k
About
Posts
5
Topics
4
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • DLL Programming
    S Snillet2k

    Hello everyone. I want to learn DLL programming. If you know where I can find good tutorials or sites that I can learn basic DLL programming, it would be great if you tell me. :)

    C / C++ / MFC

  • raw data to bitmap
    S Snillet2k

    Hello. I have posted a question about this before but i wrote it bad. So i try again. I'm working with a program that storage BMP and WAV files in one file. I'm almost finished with it but I want to make it show BMP files directly from the packed file without extracting it. I have tried many times but I can't make function to put BITMAPINFOHEADER and BITMAPINFO correct data. /////////////////////////////////////////////////////////////////////////////// LPTSTR szFileName = "C:\\Min Projekt\\MittPixelTest\\3_16.bmp"; CFile test; test.Open(szFileName, CFile::modeRead); DWORD m_nMaxSize = test.GetLength(); void *pBuf = (BYTE *) malloc(sizeof(BYTE) * m_nMaxSize); test.ReadHuge((LPVOID) pBuf, m_nMaxSize); LoadBMPImage(pBuf, m_nMaxSize, myBmp, &myPalette); /////////////////////////////////////////////////////////////////////////////// BOOL CMyArchiveDlg::LoadBMPImage(void* vBits, DWORD len, CBitmap &bitmap, CPalette *pPal) { BITMAPFILEHEADER bmfHeader; // Read file header if (!memcpy((LPSTR)&bmfHeader, vBits, sizeof(bmfHeader))) return FALSE; // File type should be 'BM' if (bmfHeader.bfType != ((WORD) ('M' << 8) | 'B')) return FALSE; // Get length of the remainder of the file and allocate memory DWORD nPackedDIBLen = len - sizeof(BITMAPFILEHEADER); HGLOBAL hDIB = ::GlobalAlloc(GMEM_FIXED, nPackedDIBLen); if (hDIB == 0) return FALSE; // Read the remainder of the bitmap file. if (!memcpy((LPSTR)hDIB, vBits, nPackedDIBLen)) { ::GlobalFree(hDIB); return FALSE; } BITMAPINFOHEADER &bmiHeader = *(LPBITMAPINFOHEADER)hDIB ; // Gets wrong data BITMAPINFO &bmInfo = *(LPBITMAPINFO)hDIB ; // If bmiHeader.biClrUsed is zero we have to infer the number // of colors from the number of bits used to specify it. int nColors = bmiHeader.biClrUsed ? bmiHeader.biClrUsed : 1 << bmiHeader.biBitCount; // Color value is to high!! LPVOID lpDIBBits; if( bmInfo.bmiHeader.biBitCount > 8 ) lpDIBBits = (LPVOID)((LPDWORD)(bmInfo.bmiColors + bmInfo.bmiHeader.biClrUsed) + ((bmInfo.bmiHeader.biCompression == BI_BITFIELDS) ? 3 : 0)); else lpDIBBits = (LPVOID)(bmInfo.bmiColors + nColors); // Create the logical palette if( pPal != NULL ) { // Create the palette if( nColors <= 256 ) { UINT nSize = sizeof(LOGPALETTE) + (sizeof(PALETTEENTRY) * nColors); LOGPALETTE *pLP = (LOGPALETTE *) new BYTE[nSize]; pLP->palVersion = 0x300; pLP->palNumEntries = nColors; for( int i=0; i < nColors; i++) {

    C / C++ / MFC question graphics performance

  • Capture console buffer to text
    S Snillet2k

    Hi. Is there a way to capture a char from console buffer in a Win 32 Console Application? I know how to place the cursor on the console screen and replace something but now I wanna know how I get the char from the cursor.

    C / C++ / MFC tutorial question

  • Prevent to open program multiplie times
    S Snillet2k

    Hi. Do anyone know how I make my programs to only open one time and not multiplie times? Exampel when my program is open and I start it again then the already open program shall show up and not open it again. Just like Windows Media player.

    C / C++ / MFC question

  • Popup Menus
    S Snillet2k

    I readed this topic and I tested it. HitTest() and SelectItem() dosen't exist when i try to complie it. Do I have to include header files or something?

    C / C++ / MFC data-structures tutorial question
  • Login

  • Don't have an account? Register

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