Skip to content

GetLastFrameAsHBITMAP

function

Delphi
function GetLastFrameAsHBITMAP (BufferIndex: LongInt; WithOverlays: Boolean; SrcLeftLocation: LongInt; SrcTopLocation: LongInt; SrcWidth: LongInt; SrcHeight: LongInt; DestWidth: LongInt; DestHeight: LongInt; BitmapColorBitCount: LongInt): NativeInt;
C++Builder
HBITMAP __fastcall GetLastFrameAsHBITMAP(System::LongInt BufferIndex, bool WithOverlays, System::LongInt SrcLeftLocation, System::LongInt SrcTopLocation, System::LongInt SrcWidth, System::LongInt SrcHeight, System::LongInt DestWidth, System::LongInt DestHeight, System::LongInt BitmapColorBitCount);
C#
public IntPtr GetLastFrameAsHBITMAP(int BufferIndex, bool WithOverlays, int SrcLeftLocation, int SrcTopLocation, int SrcWidth, int SrcHeight, int DestWidth, int DestHeight, int BitmapColorBitCount);
VB.NET
Public Function GetLastFrameAsHBITMAP(BufferIndex As Integer, WithOverlays As Boolean, SrcLeftLocation As Integer, SrcTopLocation As Integer, SrcWidth As Integer, SrcHeight As Integer, DestWidth As Integer, DestHeight As Integer, BitmapColorBitCount As Integer) As IntPtr
C++/Qt
HBITMAP GetLastFrameAsHBITMAP (int BufferIndex, BOOL WithOverlays, int SrcLeftLocation, int SrcTopLocation, int SrcWidth, int SrcHeight, int DestWidth, int DestHeight, int BitmapColorBitCount);

Returns the last video frame as a HBITMAP memory bitmap handle

Remarks

Used to get the last video frame as a memory bitmap.

The function returns a HBITMAP bitmap handle.

Don't forget to invoke DeleteObject (bitmap handle) to release the memory once done with the bitmap, otherwise the memory will quickly run out. BufferIndex: LongInt; 0 = the current video frame (usual value) 1 = the previous video frame (n-1) 2 = the video frame n-2... (the size of the buffer may vary, usually don't try to use frames older than n-4) If the index is out of the buffer the function return 0

WithOverlays: Boolean; if false, the native frame without overlays is returned if true, the frame with overlays applied is returned

SrcLeftLocation: LongInt; x location of the rectangle to capture (usually 0 for a full frame)

SrcTopLocation: LongInt; y location of the rectangle to capture (usually 0 for a full frame)

SrcWidth: LongInt; width of the rectangle to capture (usually 0 for a full width)

SrcHeight: LongInt; height of the rectangle to capture (usually 0 for a full height)

DestWidth: LongInt; width of the desired bitmap (0 will return a bitmap having the source width)

DestHeight: LongInt; height of the desired bitmap (0 will return a bitmap having the source height)

BitmapColorBitCount: LongInt color bit count of the desired bitmap. Valid values are 32, 24, 16, 15, 8. 0 returns a bitmap having the same color count than the video frame (usually 24 or 32, depending on the FrameGrabberRGBFormat setting)

E.g.:

BitmapHandle = VideoGrabber.GetLastFrameAsTBitmap (0, false, 0, 0, 0, 0, 0, 0, 0) returns the last video frame without overlays in its current size

BitmapHandle = VideoGrabber.GetLastFrameAsTBitmap (0, false, 0, 0, 0, 0, 320, 240, 8) returns the previous video frame with overlays as a 320x240 bitmap, 8 bits color