網絡收到RGB圖片數據,加上BMP信息頭,以BMP的顯示顯示
{ BITMAPINFOHEADER header; header.biSize = 40; // header size header.biWidth = svrMgr->ImgWidth; header.biHeight = svrMgr->ImgHeight; header.biPlanes = 1; header.biBitCount = 24; // RGB encoded, 24 bit header.biCompression = BI_RGB; // no compression header.biSizeImage = 0; header.biXPelsPerMeter = 0; header.biYPelsPerMeter = 0; header.biClrUsed = 0; header.biClrImportant = 0; BITMAPINFO bitmapInfo; bitmapInfo.bmiHeader = header; ::SetDIBitsToDevice(::GetDC(svrMgr->m_stcPlayWnd1.m_hWnd), 0, 0,bitmapInfo.bmiHeader.biWidth, bitmapInfo.bmiHeader.biHeight, 0, 0, 0, bitmapInfo.bmiHeader.biHeight, svrMgr->strEncode, (BITMAPINFO*)&bitmapInfo, DIB_RGB_COLORS); // HBITMAP hBitmap = (HBITMAP) ::LoadImage(NULL, szFile, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE | LR_CREATEDIBSECTION | LR_DEFAULTSIZE); // HDC hDC,hMemDC; // hMemDC = CreateCompatibleDC(NULL); // 建立內存設備描述表 // SelectObject(hMemDC,hBitmap); // 內存設備描述表選中位圖 // hDC = ::GetDC(svrMgr->m_stcPlayWnd1.m_hWnd); // 申請窗口句柄 // BitBlt(hDC,0,0,300,300,hMemDC,0,0,SRCCOPY); // 像素數據塊操作 // DeleteObject(hMemDC); // DeleteDC(hMemDC); // 釋放內存設備描述表 // ::ReleaseDC(svrMgr->m_stcPlayWnd1.m_hWnd,hDC); // 釋放窗口句柄 //} }