GetDIB
Top  Previous  Next

Description

Returns the handler to a Device Independent Bitmap.


Syntax


[VB]
Value=objActiveUSB.GetDIB()


[C/C++]
HRESULT GetDIB(HGLOBAL* pDib);


Data Types
[VB]

Return value: long


Parameters
[C/C++]

X [in]  
The x-coordinate of the pixel  
Y [in]  
The y-coordinate of the pixel  
pDib [out,retval]  
Pointer to the handler to ActiveUSB's display DIB  


Return Values


S_OK  
Success  
E_FAIL  
Failure.  

Example


This C example demonstrates how to retrieve and display ActiveUSB's DIB

 
BITMAPINFO *pDIB;
pActiveUSB->GetDIB((ULONG*)&pDIB);
RECT rect; 
long
 sx,sy;
GetWindowRect(hWnd,&rect);
pActiveUSB->GetSizeX(&sx);
pActiveUSB->GetSizeY(&sy);
BYTE* pData=(BYTE*)pDIB+
sizeof
(BITMAPINFOHEADER) + pDIB->bmiHeader.biClrUsed * 
sizeof
(RGBQUAD);
SetDIBitsToDevice(hDC, 0, 0, sx, sy, 0, 0, 0, sy, pData, pDIB, DIB_RGB_COLORS); 



Remarks


The GetDIB method provides the most efficient way to display the internal image buffer when you do not want to use ActiveUSB's live display. ActiveUSB uses packed DIBs, the pixel data immediately following the BITMAPINFO structure. The method returns a GlobalAlloc handler which contains the pointer to a DIB. The application must not free the global handler after using the DIB data.

Note that a DIB contains only 8- and 24-bit pixel values, even if the current video mode is a 16- or 48-bit one. To access the actual pixel data, use the GetImageData or GetPointer methods.