27
/* Function: AcquireToHost */
BOOL AcquireToHost()
{
OLT_APISTATUS Status = 0L;
ULNG ulPixelDepth = 0L;
ULNG ulMinBufSize = 0L;
Frame = GlobalAlloc (GHND, sizeof(OLT_FG_FRAME_INFO));
ulHeight = 0L;
ulWidth = 0L;
GlobalUnlock(hAcquireBuf);
GlobalFree(hAcquireBuf);
hAcquireBuf = NULL;
hpAcquireBuf = NULL;
// Query for Height, Width and Pixel Depth of the frame
(void) OlFgQueryInputControlValue(CurDevInfo.DevId,
CurDevInfo.InputSource,
OLC_FG_CTL_FRAME_HEIGHT,
&ulHeight);
(void) OlFgQueryInputControlValue(CurDevInfo.DevId,
CurDevInfo.InputSource,
OLC_FG_CTL_FRAME_WIDTH,
&ulWidth);
(void) OlFgQueryInputCaps(CurDevInfo.DevId,
OLC_FG_IC_PIXEL_DEPTH,
&ulPixelDepth,
sizeof(ULNG));
// calculate minimum size of buffer in bytes *
ulMinBufSize = ulHeight * ulWidth * ulPixelDepth;
hAcquireBuf = GlobalAlloc(GHND, ulMinBufSize);
if ( !hAcquireBuf )
{
// unable to allocate memory
mexPrintf("Unable to allocate enough memory for
acquire.\n");
return FALSE;
}
hpAcquireBuf = (HPUCHR) GlobalLock(hAcquireBuf);
if ( !hpAcquireBuf)
{
// unable to lock memory
TCHAR szBuf[80];
LPVOID lpMsgBuf;
DWORD dw = GetLastError();
Komentarze do niniejszej Instrukcji