my program 's purpose is making a screen capture every 1/16 second , and send it by socket to remote server .
current this program can work with BMP format screen capture , however , the BMP format data have too many bytes to send , it obviously slow the send and recv process .
my idea is : if I can convert the BMP into PNG , and zip it before send , maybe the program can work more smooth .
here is my code , select from gh0st project
LPVOID m_lpvFullBits = NULL;
HDC m_hFullDC, m_hFullMemDC;
LPBITMAPINFO m_lpbmi_full;
m_hFullDC = GetDC(NULL);
int m_nFullWidth = ::GetSystemMetrics(SM_CXSCREEN);
int m_nFullHeight = ::GetSystemMetrics(SM_CYSCREEN);
m_hFullMemDC = ::CreateCompatibleDC(m_hFullDC);
m_lpbmi_full = (BITMAPINFO *) new BYTE[40];
BITMAPINFOHEADER *lpbmih = &(m_lpbmi_full ->bmiHeader);
lpbmih->biSize = sizeof(BITMAPINFOHEADER);
lpbmih->biWidth = m_nFullWidth ;
lpbmih->biHeight = m_nFullHeight ;
lpbmih->biPlanes = 1;
lpbmih->biBitCount = 32; // 32 bit per pixel
lpbmih->biCompression = BI_RGB;
lpbmih->biXPelsPerMeter = 0;
lpbmih->biYPelsPerMeter = 0;
lpbmih->biClrUsed = 0;
lpbmih->biClrImportant = 0;
lpbmih->biSizeImage = (((lpbmih->biWidth * lpbmih->biBitCount + 31) & ~31) >> 3) * lpbmih->biHeight;
HBITMAP m_hFullBitmap = ::CreateDIBSection(m_hFullDC, m_lpbmi_full, DIB_RGB_COLORS, &m_lpvFullBits, NULL, NULL);
::SelectObject(m_hFullMemDC, m_hFullBitmap);
::BitBlt(m_hFullMemDC, 0, 0, m_nFullWidth, m_nFullHeight, m_hFullDC, 0, 0, SRCCOPY);
until this statement :
::BitBlt(m_hFullMemDC, 0, 0, m_nFullWidth, m_nFullHeight, m_hFullDC, 0, 0, SRCCOPY);
BMP pixel data is saved at address begin from m_lpvFullBits , right ?
Now what I want to know is , can I use the current known info such as width , height , BMP pixel data .. , rebuild a new png format in-memory data which is much more smaller than current BMP data , and send the new png format data by socket to remote server ?
thanks for any help