Example #1
0
bool CCaptureImage::LockData(BITMAPINFO **ppbmi,BYTE **ppBits)
{
    if (m_hData==NULL || m_fLocked)
        return false;

    void *pDib=::GlobalLock(m_hData);
    BITMAPINFO *pbmi;

    if (pDib==NULL)
        return false;
    pbmi=static_cast<BITMAPINFO*>(pDib);
    if (ppbmi!=NULL)
        *ppbmi=pbmi;
    if (ppBits!=NULL)
        *ppBits=static_cast<BYTE*>(pDib)+CalcDIBInfoSize(&pbmi->bmiHeader);
    m_fLocked=true;
    return true;
}
Example #2
0
CCaptureImage::CCaptureImage(const BITMAPINFO *pbmi,const void *pBits)
{
    SIZE_T InfoSize,BitsSize;

    InfoSize=CalcDIBInfoSize(&pbmi->bmiHeader);
    BitsSize=CalcDIBBitsSize(&pbmi->bmiHeader);
    m_hData=::GlobalAlloc(GMEM_MOVEABLE | GMEM_SHARE,InfoSize+BitsSize);
    if (m_hData!=NULL) {
        BYTE *pData=static_cast<BYTE*>(::GlobalLock(m_hData));

        if (pData!=NULL) {
            ::CopyMemory(pData,pbmi,InfoSize);
            ::CopyMemory(pData+InfoSize,pBits,BitsSize);
            ::GlobalUnlock(m_hData);
        } else {
            ::GlobalFree(m_hData);
            m_hData=NULL;
        }
    }
    m_fLocked=false;
    ::GetLocalTime(&m_stCaptureTime);
}
Example #3
0
SIZE_T CalcDIBSize(const BITMAPINFOHEADER *pbmih)
{
	return CalcDIBInfoSize(pbmih)+CalcDIBBitsSize(pbmih);
}