// Here, we grab DC's and stuff from vfw and stash it into our own // instance info. We also get our movieinfo, which is the structure // that has the actual hotspots in it. It's in a global variable, even // though I don't like global variables... static LONG NEAR PASCAL AVIDrawBegin(PINSTINFO pi, ICDRAWBEGIN FAR *lpicd, LONG cbicd) { LONG l; l = AVIDrawQuery(pi, lpicd->lpbi); if ((l != 0) || (lpicd->dwFlags & ICDRAW_QUERY)) { return l; } pi->hdc = lpicd->hdc; pi->xDst = lpicd->xDst; pi->yDst = lpicd->yDst; pi->dxDst = lpicd->dxDst; pi->dyDst = lpicd->dyDst; pi->xSrc = lpicd->xSrc; pi->ySrc = lpicd->ySrc; pi->dxSrc = lpicd->dxSrc; pi->dySrc = lpicd->dySrc; SetStretchBltMode(pi->hdc, COLORONCOLOR); if (!DrawDibBegin(pi->hdd, pi->hdc, pi->dxDst, pi->dyDst, lpicd->lpbi, pi->dxSrc, pi->dySrc, 0)) { return ICERR_UNSUPPORTED; } if (pi->hddb) { DisintegrateMemoryDC(pi); } CreateMemoryDC(pi); pi->lpMovie = pMovieInfo; return ICERR_OK; }
// Here, we grab DC's and stuff from vfw and stash it into our own // instance info. We also get our movieinfo, which is the structure // that has the actual hotspots in it. A handle to it has been stuck // on the window with SetProp, so we get the window handle and snag it // with GetProp. static LONG NEAR PASCAL AVIDrawBegin(PINSTINFO pi, ICDRAWBEGIN FAR *lpicd, LONG cbicd) { LONG l; l = AVIDrawQuery(pi, lpicd->lpbi); if ((l != 0) || (lpicd->dwFlags & ICDRAW_QUERY)) { return l; } pi->hdc = lpicd->hdc; pi->xDst = lpicd->xDst; pi->yDst = lpicd->yDst; pi->dxDst = lpicd->dxDst; pi->dyDst = lpicd->dyDst; pi->xSrc = lpicd->xSrc; pi->ySrc = lpicd->ySrc; pi->dxSrc = lpicd->dxSrc; pi->dySrc = lpicd->dySrc; SetStretchBltMode(pi->hdc, COLORONCOLOR); if (!DrawDibBegin(pi->hdd, pi->hdc, pi->dxDst, pi->dyDst, lpicd->lpbi, pi->dxSrc, pi->dySrc, 0)) { return ICERR_UNSUPPORTED; } if (pi->hddb) { DisintegrateMemoryDC(pi); } CreateMemoryDC(pi); { HANDLE hglb; hglb = GetProp(lpicd->hwnd,szDrawPropName); if (hglb) { pi->lpMovie = (PMOVIEINFO) GlobalLock(hglb); pi->hMovie = hglb; } else { pi->lpMovie = NULL; pi->hMovie = NULL; } } return ICERR_OK; }
// this is the drawproc that vfw calls. It basically just hands // stuff off to other functions later in this file. A few things // are handled here. This is message-handling proc just like a // Window Proc or a VBX Control Proc... LONG FAR PASCAL _export ICAVIDrawProc(DWORD id, HDRVR hDriver, UINT uiMessage, LPARAM lParam1, LPARAM lParam2) { PINSTINFO pi = (PINSTINFO)id; switch (uiMessage) { case DRV_LOAD: case DRV_FREE: return 1; case DRV_OPEN: if (lParam2 == 0L) { // Uh-oh, no data to use... return 1; } return AVIDrawOpen((ICOPEN FAR *)lParam2); case DRV_CLOSE: return AVIDrawClose(pi); case DRV_QUERYCONFIGURE: return 0; case DRV_CONFIGURE: return 1; case ICM_CONFIGURE: case ICM_ABOUT: return ICERR_UNSUPPORTED; case ICM_GETSTATE: return 0L; case ICM_GETINFO: return AVIDrawGetInfo((ICINFO FAR *)lParam1, lParam2); case ICM_DRAW_QUERY: return AVIDrawQuery(pi, (LPBITMAPINFOHEADER)lParam1); case ICM_DRAW_SUGGESTFORMAT: return AVIDrawSuggestFormat(pi, (ICDRAWSUGGEST FAR *) lParam1, lParam2); case ICM_DRAW_BEGIN: return AVIDrawBegin(pi, (ICDRAWBEGIN FAR *) lParam1, lParam2); case ICM_DRAW_REALIZE: pi->hdc = (HDC) lParam1; if (!pi->hdc || !pi->hdd) { // we aren't initialized yet. break; } return DrawDibRealize(pi->hdd, pi->hdc, (BOOL) lParam2); case ICM_DRAW_GET_PALETTE: if (!pi->hdd) { break; } return (LONG) (UINT) DrawDibGetPalette(pi->hdd); case ICM_DRAW: return AVIDraw(pi, (ICDRAW FAR *)lParam1, lParam2); case ICM_DRAW_CHANGEPALETTE: return AVIDrawChangePalette(pi, (LPBITMAPINFOHEADER) lParam1); case ICM_DRAW_END: return AVIDrawEnd(pi); case DRV_DISABLE: case DRV_ENABLE: return 1; case DRV_INSTALL: case DRV_REMOVE: return 1; } if (uiMessage < DRV_USER) { return DefDriverProc(id,hDriver,uiMessage,lParam1,lParam2); } else { return ICERR_UNSUPPORTED; } }