' ########################################################################################
' Microsoft Windows
' File: Vfw.inc
' Contents: Video for windows include file for WIN32
' Copyright (c) 2011 Jos? Roca
' Portions Copyright (c) Microsoft Corporation.
' All Rights Reserved.
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
' ########################################################################################
#IF NOT %DEF(PBX_Vfw_PBI)
#DEFINE PBX_Vfw_PBI
%EQUATE `VFW_INC = 1
'/****************************************************************************
' *
' * VfW.H - Video for windows include file for WIN32
' *
' * Copyright (c) 1991-1995, Microsoft Corp. All rights reserved.
' *
' * This include files defines interfaces to the following
' * video components
' *
' * COMPMAN - Installable Compression Manager.
' * DRAWDIB - Routines for drawing to the display.
' * VIDEO - Video Capture Driver Interface
' *
' * AVIFMT - AVI File Format structure definitions.
' * MMREG - FOURCC and other things
' *
' * AVIFile - Interface for reading AVI Files and AVI Streams
' * MCIWND - MCI/AVI window class
' * AVICAP - AVI Capture Window class
' *
' * MSACM - Audio compression manager.
' *
' * The following symbols control inclusion of various parts of this file:
' *
' * NOCOMPMAN - dont include COMPMAN
' * NODRAWDIB - dont include DRAWDIB
' * NOVIDEO - dont include video capture interface
' *
' * NOAVIFMT - dont include AVI file format structs
' * NOMMREG - dont include MMREG
' *
' * NOAVIFILE - dont include AVIFile interface
' * NOMCIWND - dont include AVIWnd class.
' * NOAVICAP - dont include AVICap class.
' *
' * NOMSACM - dont include ACM stuff.
' *
' ****************************************************************************/
#INCLUDE ONCE "Core/Windows.inc"
'/****************************************************************************
' *
' * types
' *
' ***************************************************************************/
'#define VFWAPI WINAPI
'#define VFWAPIV WINAPIV
'#define VFWAPI_INLINE WINAPI_INLINE
'/****************************************************************************
' *
' * VideoForWindowsVersion() - returns version of VfW
' *
' ***************************************************************************/
DECLARE FUNCTION VideoForWindowsVersion LIB "msvfw32.dll" ALIAS "VideoForWindowsVersion" ( ) AS QUAD
'/****************************************************************************
' *
' * call these to start stop using VfW from your app.
' *
' ***************************************************************************/
DECLARE FUNCTION InitVFW LIB "msvfw32.dll" ALIAS "InitVFW" () AS LONG
DECLARE FUNCTION TermVFW LIB "msvfw32.dll" ALIAS "TermVFW" () AS LONG
'/****************************************************************************
' *
' * do we need MMSYSTEM?
' *
' ****************************************************************************/
'#if !defined(_INC_MMSYSTEM) && (!defined(NOVIDEO) || !defined(NOAVICAP))
' #include <mmsystem.h>
'#endif
#IF NOT %DEF(%MMSYSTEM_INC)
 #IF NOT %DEF(%NOVIDEO)
 #IF NOT %DEF(%NOAVICAP)
 #INCLUDE ONCE "Legacy/System/MMSystem.inc"
 #ENDIF
 #ENDIF
#ENDIF
'/****************************************************************************/
'/* */
'/* Macros */
'/* */
'/* should we define this?? */
'/* */
'/****************************************************************************/
'#ifndef MKFOURCC
'#define MKFOURCC( ch0, ch1, ch2, ch3 ) \
' ( (DWORD)(BYTE)(ch0) | ( (DWORD)(BYTE)(ch1) << 8 ) | \
' ( (DWORD)(BYTE)(ch2) << 16 ) | ( (DWORD)(BYTE)(ch3) << 24 ) )
'#endif
'#if !defined(_INC_MMSYSTEM)
' #define mmioFOURCC MKFOURCC
'#endif
#IF NOT %DEF(%MAKEFOURCC_DEFINED)
%EQUATE `MAKEFOURCC_DEFINED = 1
FUNCTION MAKEFOURCC (BYVAL st0 AS STRING, BYVAL st1 AS STRING, BYVAL st2 AS STRING, BYVAL st3 AS STRING) AS DWORD
 LOCAL ch0 AS DWORD, ch1 AS DWORD, ch2 AS DWORD, ch3 AS DWORD
 ch0 = ASC(st0)
 ch1 = ASC(st1)
 ch2 = ASC(st2)
 ch3 = ASC(st3)
 SHIFT LEFT ch1, 8
 SHIFT LEFT ch2, 16
 SHIFT LEFT ch3, 24
 FUNCTION = ch0 OR ch1 OR ch2 OR ch3
END FUNCTION
#ENDIF
'/****************************************************************************
' *
' * COMPMAN - Installable Compression Manager.
' *
' ****************************************************************************/
#IF NOT %DEF(%NOCOMPMAN) ' ---------------------------------------------------------------
%EQUATE `ICVERSION = &H0104
'DECLARE_HANDLE(HIC); /* Handle to a Installable Compressor */
'//
'// this code in biCompression means the DIB must be accesed via
'// 48 bit pointers! using *ONLY* the selector given.
'//
%EQUATE `BI_1632 = &H32333631 ' // '1632'
'#ifndef mmioFOURCC
'#define mmioFOURCC( ch0, ch1, ch2, ch3 ) \
' ( (DWORD)(BYTE)(ch0) | ( (DWORD)(BYTE)(ch1) << 8 ) | \
' ( (DWORD)(BYTE)(ch2) << 16 ) | ( (DWORD)(BYTE)(ch3) << 24 ) )
'#endif
#IF NOT %DEF(%MMIOFOURCC_DEFINED)
%EQUATE `MMIOFOURCC_DEFINED = 1
FUNCTION mmioFOURCC (BYVAL st0 AS STRING, BYVAL st1 AS STRING, BYVAL st2 AS STRING, BYVAL st3 AS STRING) AS DWORD
 LOCAL ch0 AS DWORD, ch1 AS DWORD, ch2 AS DWORD, ch3 AS DWORD
 ch0 = ASC(st0)
 ch1 = ASC(st1)
 ch2 = ASC(st2)
 ch3 = ASC(st3)
 SHIFT LEFT ch1, 8
 SHIFT LEFT ch2, 16
 SHIFT LEFT ch3, 24
 FUNCTION = ch0 OR ch1 OR ch2 OR ch3
END FUNCTION
#ENDIF
'#ifndef aviTWOCC
'#define aviTWOCC(ch0, ch1) ((WORD)(BYTE)(ch0) | ((WORD)(BYTE)(ch1) << 8))
'#endif
#IF NOT %DEF(%AVITWOCC_DEFINED)
%EQUATE `AVITWOCC_DEFINED = 1
FUNCTION aviTWOCC (BYVAL st0 AS STRING, BYVAL st1 AS STRING) AS WORD
 LOCAL ch0 AS WORD, ch1 AS WORD
 ch0 = ASC(st0)
 ch1 = ASC(st1)
 SHIFT LEFT ch1, 8
 FUNCTION = ch0 OR ch1
END FUNCTION
#ENDIF
'#ifndef ICTYPE_VIDEO
'#define ICTYPE_VIDEO mmioFOURCC('v', 'i', 'd', 'c')
'#define ICTYPE_AUDIO mmioFOURCC('a', 'u', 'd', 'c')
'#endif
#IF NOT %DEF(%ICTYPE_VIDEO)
%EQUATE `ICTYPE_VIDEO = &H63646976 ' mmioFOURCC('v', 'i', 'd', 'c')
%EQUATE `ICTYPE_AUDIO = &H63647561 ' mmioFOURCC('a', 'u', 'd', 'c')
#ENDIF
%EQUATE `ICERR_OK = 0&
%EQUATE `ICERR_DONTDRAW = 1&
%EQUATE `ICERR_NEWPALETTE = 2&
%EQUATE `ICERR_GOTOKEYFRAME = 3&
%EQUATE `ICERR_STOPDRAWING = 4&
%EQUATE `ICERR_UNSUPPORTED = -1&
%EQUATE `ICERR_BADFORMAT = -2&
%EQUATE `ICERR_MEMORY = -3&
%EQUATE `ICERR_INTERNAL = -4&
%EQUATE `ICERR_BADFLAGS = -5&
%EQUATE `ICERR_BADPARAM = -6&
%EQUATE `ICERR_BADSIZE = -7&
%EQUATE `ICERR_BADHANDLE = -8&
%EQUATE `ICERR_CANTUPDATE = -9&
%EQUATE `ICERR_ABORT = -10&
%EQUATE `ICERR_ERROR = -100&
%EQUATE `ICERR_BADBITDEPTH = -200&
%EQUATE `ICERR_BADIMAGESIZE = -201&
%EQUATE `ICERR_CUSTOM = -400& ' // errors less than ICERR_CUSTOM...
'#endif
'/* Values for dwFlags of ICOpen() */
#IF NOT %DEF(%ICMODE_COMPRESS)
%EQUATE `ICMODE_COMPRESS = 1
%EQUATE `ICMODE_DECOMPRESS = 2
%EQUATE `ICMODE_FASTDECOMPRESS = 3
%EQUATE `ICMODE_QUERY = 4
%EQUATE `ICMODE_FASTCOMPRESS = 5
%EQUATE `ICMODE_DRAW = 8
#ENDIF
'#ifndef _WIN32 // ;Internal
'#define ICMODE_INTERNALF_FUNCTION32 0x8000 // ;Internal
'#define ICMODE_INTERNALF_MASK 0x8000 // ;Internal
'#endif // ;Internal
'/* Flags for AVI file index */
%EQUATE `AVIIF_LIST = &H00000001
%EQUATE `AVIIF_TWOCC = &H00000002
%EQUATE `AVIIF_KEYFRAME = &H00000010
'/* quality flags */
%EQUATE `ICQUALITY_LOW = 0
%EQUATE `ICQUALITY_HIGH = 10000
%EQUATE `ICQUALITY_DEFAULT = -1
'/************************************************************************
'************************************************************************/
%EQUATE `ICM_USER = %DRV_USER + &H0000
%EQUATE `ICM_RESERVED_LOW = %DRV_USER + &H1000
%EQUATE `ICM_RESERVED_HIGH = %DRV_USER + &H2000
%EQUATE `ICM_RESERVED = %ICM_RESERVED_LOW
'/************************************************************************
' messages.
'************************************************************************/
%EQUATE `ICM_GETSTATE = %ICM_RESERVED + 0 ' // Get compressor state
%EQUATE `ICM_SETSTATE = %ICM_RESERVED + 1 ' // Set compressor state
%EQUATE `ICM_GETINFO = %ICM_RESERVED + 2 ' // Query info about the compressor
%EQUATE `ICM_CONFIGURE = %ICM_RESERVED + 10 ' // show the configure dialog
%EQUATE `ICM_ABOUT = %ICM_RESERVED + 11 ' // show the about box
%EQUATE `ICM_GETERRORTEXT = %ICM_RESERVED + 12 ' // get error text TBD ;Internal
%EQUATE `ICM_GETFORMATNAME = %ICM_RESERVED + 20 ' // get a name for a format ;Internal
%EQUATE `ICM_ENUMFORMATS = %ICM_RESERVED + 21 ' // cycle through formats ;Internal
%EQUATE `ICM_GETDEFAULTQUALITY = %ICM_RESERVED + 30 ' // get the default value for quality
%EQUATE `ICM_GETQUALITY = %ICM_RESERVED + 31 ' // get the current value for quality
%EQUATE `ICM_SETQUALITY = %ICM_RESERVED + 32 ' // set the default value for quality
%EQUATE `ICM_SET = %ICM_RESERVED + 40 ' // Tell the driver something
%EQUATE `ICM_GET = %ICM_RESERVED + 41 ' // Ask the driver something
' // Constants for ICM_SET:
%EQUATE `ICM_FRAMERATE = &H526D7246 ' mmioFOURCC('F','r','m','R')
%EQUATE `ICM_KEYFRAMERATE = &H5279654B ' mmioFOURCC('K','e','y','R')
'/************************************************************************
' ICM specific messages.
'************************************************************************/
%EQUATE `ICM_COMPRESS_GET_FORMAT = %ICM_USER + 4 ' // get compress format or size
%EQUATE `ICM_COMPRESS_GET_SIZE = %ICM_USER + 5 ' // get output size
%EQUATE `ICM_COMPRESS_QUERY = %ICM_USER + 6 ' // query support for compress
%EQUATE `ICM_COMPRESS_BEGIN = %ICM_USER + 7 ' // begin a series of compress calls.
%EQUATE `ICM_COMPRESS = %ICM_USER + 8 ' // compress a frame
%EQUATE `ICM_COMPRESS_END = %ICM_USER + 9 ' // end of a series of compress calls.
%EQUATE `ICM_DECOMPRESS_GET_FORMAT = %ICM_USER + 10 ' // get decompress format or size
%EQUATE `ICM_DECOMPRESS_QUERY = %ICM_USER + 11 ' // query support for dempress
%EQUATE `ICM_DECOMPRESS_BEGIN = %ICM_USER + 12 ' // start a series of decompress calls
%EQUATE `ICM_DECOMPRESS = %ICM_USER + 13 ' // decompress a frame
%EQUATE `ICM_DECOMPRESS_END = %ICM_USER + 14 ' // end a series of decompress calls
%EQUATE `ICM_DECOMPRESS_SET_PALETTE = %ICM_USER + 29 ' // fill in the DIB color table
%EQUATE `ICM_DECOMPRESS_GET_PALETTE = %ICM_USER + 30 ' // fill in the DIB color table
%EQUATE `ICM_DRAW_QUERY = %ICM_USER + 31 ' // query support for dempress
%EQUATE `ICM_DRAW_BEGIN = %ICM_USER + 15 ' // start a series of draw calls
%EQUATE `ICM_DRAW_GET_PALETTE = %ICM_USER + 16 ' // get the palette needed for drawing
%EQUATE `ICM_DRAW_UPDATE = %ICM_USER + 17 ' // update screen with current frame ;Internal
%EQUATE `ICM_DRAW_START = %ICM_USER + 18 ' // start decompress clock
%EQUATE `ICM_DRAW_STOP = %ICM_USER + 19 ' // stop decompress clock
%EQUATE `ICM_DRAW_BITS = %ICM_USER + 20 ' // decompress a frame to screen ;Internal
%EQUATE `ICM_DRAW_END = %ICM_USER + 21 ' // end a series of draw calls
%EQUATE `ICM_DRAW_GETTIME = %ICM_USER + 32 ' // get value of decompress clock
%EQUATE `ICM_DRAW = %ICM_USER + 33 ' // generalized "render" message
%EQUATE `ICM_DRAW_WINDOW = %ICM_USER + 34 ' // drawing window has moved or hidden
%EQUATE `ICM_DRAW_SETTIME = %ICM_USER + 35 ' // set correct value for decompress clock
%EQUATE `ICM_DRAW_REALIZE = %ICM_USER + 36 ' // realize palette for drawing
%EQUATE `ICM_DRAW_FLUSH = %ICM_USER + 37 ' // clear out buffered frames
%EQUATE `ICM_DRAW_RENDERBUFFER = %ICM_USER + 38 ' // draw undrawn things in queue
%EQUATE `ICM_DRAW_START_PLAY = %ICM_USER + 39 ' // start of a play
%EQUATE `ICM_DRAW_STOP_PLAY = %ICM_USER + 40 ' // end of a play
%EQUATE `ICM_DRAW_SUGGESTFORMAT = %ICM_USER + 50 ' // Like ICGetDisplayFormat
%EQUATE `ICM_DRAW_CHANGEPALETTE = %ICM_USER + 51 ' // for animating palette
%EQUATE `ICM_DRAW_IDLE = %ICM_USER + 52 ' // send each frame time ;Internal
%EQUATE `ICM_GETBUFFERSWANTED = %ICM_USER + 41 ' // ask about prebuffering
%EQUATE `ICM_GETDEFAULTKEYFRAMERATE = %ICM_USER + 42 ' // get the default value for key frames
%EQUATE `ICM_DECOMPRESSEX_BEGIN = %ICM_USER + 60 ' // start a series of decompress calls
%EQUATE `ICM_DECOMPRESSEX_QUERY = %ICM_USER + 61 ' // start a series of decompress calls
%EQUATE `ICM_DECOMPRESSEX = %ICM_USER + 62 ' // decompress a frame
%EQUATE `ICM_DECOMPRESSEX_END = %ICM_USER + 63 ' // end a series of decompress calls
%EQUATE `ICM_COMPRESS_FRAMES_INFO = %ICM_USER + 70 ' // tell about compress to come
%EQUATE `ICM_COMPRESS_FRAMES = %ICM_USER + 71 ' // compress a bunch of frames ;Internal
%EQUATE `ICM_SET_STATUS_PROC = %ICM_USER + 72 ' // set status callback
'/************************************************************************
'************************************************************************/
' // Size = 36 bytes
TYPE ICOPEN_STRUCT DWORD
 dwSize AS DWORD ' DWORD // sizeof(ICOPEN)
 fccType AS DWORD ' DWORD // 'vidc'
 fccHandler AS DWORD
 dwVersion AS DWORD ' DWORD // version of compman opening you
 dwFlags AS DWORD ' DWORD // LOWORD is type specific
 dwError AS DWORD ' LRESULT // error return.
 pV1Reserved AS DWORD ' LPVOID // Reserved
 pV2Reserved AS DWORD ' LPVOID // Reserved
 dnDevNode AS DWORD ' DWORD // Devnode for PnP devices
END TYPE
MACRO tagICOPEN = ICOPEN_STRUCT
'/************************************************************************
'************************************************************************/
' // Size = 568 bytes
TYPE ICINFO_STRUCT DWORD
 dwSize AS DWORD ' DWORD // sizeof(ICINFO)
 fccType AS DWORD ' DWORD // compressor type 'vidc' 'audc'
 fccHandler AS DWORD ' DWORD // compressor sub-type 'rle ' 'jpeg' 'pcm '
 dwFlags AS DWORD ' DWORD // flags LOWORD is type specific
 dwVersion AS DWORD ' DWORD // version of the driver
 dwVersionICM AS DWORD ' DWORD // version of the ICM used
' //
' // under Win32, the driver always returns UNICODE strings.
' //
 szName AS WSTRINGZ * 16 ' WCHAR // short name
 szDescription AS WSTRINGZ * 128 ' WCHAR // long name
 szDriver AS WSTRINGZ * 128 ' WCHAR // driver that contains compressor
END TYPE
MACRO tagICINFO = ICINFO_STRUCT
'/* Flags for the <dwFlags> field of the <ICINFO> structure. */
%EQUATE `VIDCF_QUALITY = &H0001 ' // supports quality
%EQUATE `VIDCF_CRUNCH = &H0002 ' // supports crunching to a frame size
%EQUATE `VIDCF_TEMPORAL = &H0004 ' // supports inter-frame compress
%EQUATE `VIDCF_COMPRESSFRAMES = &H0008 ' // wants the compress all frames message
%EQUATE `VIDCF_DRAW = &H0010 ' // supports drawing
%EQUATE `VIDCF_FASTTEMPORALC = &H0020 ' // does not need prev frame on compress
%EQUATE `VIDCF_FASTTEMPORALD = &H0080 ' // does not need prev frame on decompress
'//#define VIDCF_QUALITYTIME 0x0040 // supports temporal quality
'//#define VIDCF_FASTTEMPORAL (VIDCF_FASTTEMPORALC|VIDCF_FASTTEMPORALD)
'/************************************************************************
'************************************************************************/
%EQUATE `ICCOMPRESS_KEYFRAME = &H00000001
' // Size = 48 bytes
TYPE ICCOMPRESS_STRUCT DWORD
 dwFlags AS DWORD ' DWORD // flags
 lpbiOutput AS BITMAPINFOHEADER PTR ' LPBITMAPINFOHEADER // output format
 lpOutput AS DWORD ' LPVOID // output data
 lpbiInput AS BITMAPINFOHEADER PTR ' LPBITMAPINFOHEADER // format of frame to compress
 lpInput AS DWORD ' LPVOID // frame data to compress
 lpckid AS DWORD PTR ' LPDWORD // ckid for data in AVI file
 lpdwFlags AS DWORD PTR ' LPDWORD // flags in the AVI index.
 lFrameNum AS LONG ' LONG // frame number of seq.
 dwFrameSize AS DWORD ' DWORD // reqested size in bytes. (if non zero)
 dwQuality AS DWORD ' DWORD // quality
 ' // these are new fields
 lpbiPrev AS BITMAPINFOHEADER PTR ' LPBITMAPINFOHEADER // format of previous frame
 lpPrev AS DWORD ' LPVOID // previous frame
END TYPE
MACRO tagICCOMPRESS = ICCOMPRESS_STRUCT
'/************************************************************************
'************************************************************************/
%EQUATE `ICCOMPRESSFRAMES_PADDING = &H00000001
' // Size = 64 bytes
TYPE ICCOMPRESSFRAMES_STRUCT DWORD
 dwFlags AS DWORD ' DWORD // flags
 lpbiOutput AS BITMAPINFOHEADER PTR ' LPBITMAPINFOHEADER // output format
 lOutput AS LONG ' LPARAM // output identifier
 lpbiInput AS BITMAPINFOHEADER PTR ' LPBITMAPINFOHEADER // format of frame to compress
 lInput AS LONG ' LPARAM // input identifier
 lStartFrame AS LONG ' LONG // start frame
 lFrameCount AS LONG ' LONG // # of frames
 lQuality AS LONG ' LONG // quality
 lDataRate AS LONG ' LONG // data rate
 lKeyRate AS LONG ' LONG // key frame rate
 dwRate AS DWORD ' DWORD // frame rate, as always
 dwScale AS DWORD
 dwOverheadPerFrame AS DWORD
 dwReserved2 AS DWORD
 pGetData AS DWORD ' LONG (CALLBACK *GetData)(LPARAM lInput, LONG lFrame, LPVOID lpBits, LONG len);
 pPutData AS DWORD ' LONG (CALLBACK *PutData)(LPARAM lOutput, LONG lFrame, LPVOID lpBits, LONG len);
END TYPE
MACRO tagICCOMPRESSFRAMES = ICCOMPRESSFRAMES_STRUCT
' // messages for Status callback
%EQUATE `ICSTATUS_START = 0
%EQUATE `ICSTATUS_STATUS = 1 ' // l == % done
%EQUATE `ICSTATUS_END = 2
%EQUATE `ICSTATUS_ERROR = 3 ' // l == error string (LPSTR)
%EQUATE `ICSTATUS_YIELD = 4
'// return nonzero means abort operation in progress
' // Size = 12 bytes
TYPE ICSETSTATUSPROC_STRUCT DWORD
 dwFlags AS DWORD
 lParam AS LONG
 Status AS DWORD ' LONG (CALLBACK *Status) (LPARAM lParam, UINT message, LONG l);
END TYPE
MACRO tagICSETSTATUSPROC = ICSETSTATUSPROC_STRUCT
'/************************************************************************
'************************************************************************/
%EQUATE `ICDECOMPRESS_HURRYUP = &H80000000 ' // don't draw just buffer (hurry up!)
%EQUATE `ICDECOMPRESS_UPDATE = &H40000000 ' // don't draw just update screen
%EQUATE `ICDECOMPRESS_PREROLL = &H20000000 ' // this frame is before real start
%EQUATE `ICDECOMPRESS_NULLFRAME = &H10000000 ' // repeat last frame
%EQUATE `ICDECOMPRESS_NOTKEYFRAME = &H08000000 ' // this frame is not a key frame
' // Size = 24 bytes
TYPE ICDECOMPRESS_STRUCT DWORD
 dwFlags AS DWORD ' DWORD // flags (from AVI index...)
 lpbiInput AS BITMAPINFOHEADER PTR ' LPBITMAPINFOHEADER // BITMAPINFO of compressed data
 ' // biSizeImage has the chunk size
 lpInput AS DWORD ' LPVOID // compressed data
 lpbiOutput AS BITMAPINFOHEADER PTR ' LPBITMAPINFOHEADER // DIB to decompress to
 lpOutput AS DWORD
 ckid AS DWORD ' DWORD // ckid from AVI file
END TYPE
MACRO tagICDECOMPRESS = ICDECOMPRESS_STRUCT
' // Size = 52 bytes
TYPE ICDECOMPRESSEX_STRUCT DWORD
 ' //
 ' // same as ICM_DECOMPRESS
 ' //
 dwFlags AS DWORD
 lpbiSrc AS BITMAPINFOHEADER PTR ' LPBITMAPINFOHEADER // BITMAPINFO of compressed data
 lpSrc AS DWORD ' LPVOID // compressed data
 lpbiDst AS BITMAPINFOHEADER PTR ' LPBITMAPINFOHEADER // DIB to decompress to
 lpDst AS DWORD ' LPVOID // output data
 ' //
 ' // new for ICM_DECOMPRESSEX
 ' //
 xDst AS LONG ' int // destination rectangle
 yDst AS LONG ' int
 dxDst AS LONG ' int
 dyDst AS LONG ' int
 xSrc AS LONG ' int // source rectangle
 ySrc AS LONG ' int
 dxSrc AS LONG ' int
 dySrc AS LONG ' int
END TYPE
MACRO tagICDECOMPRESSEX = ICDECOMPRESSEX_STRUCT
'/************************************************************************
'************************************************************************/
%EQUATE `ICDRAW_QUERY = &H00000001 ' // test for support
%EQUATE `ICDRAW_FULLSCREEN = &H00000002 ' // draw to full screen
%EQUATE `ICDRAW_HDC = &H00000004 ' // draw to a HDC/HWND
%EQUATE `ICDRAW_ANIMATE = &H00000008 ' // expect palette animation
%EQUATE `ICDRAW_CONTINUE = &H00000010 ' // draw is a continuation of previous draw
%EQUATE `ICDRAW_MEMORYDC = &H00000020 ' // DC is offscreen, by the way
%EQUATE `ICDRAW_UPDATING = &H00000040 ' // We're updating, as opposed to playing
%EQUATE `ICDRAW_RENDER = &H00000080 ' // used to render data not draw it
%EQUATE `ICDRAW_BUFFER = &H00000100 ' // please buffer this data offscreen, we will need to update it
' // Size = 60 bytes
TYPE ICDRAWBEGIN_STRUCT DWORD
 dwFlags AS DWORD ' DWORD // flags
 hpal AS DWORD ' HPALETTE // palette to draw with
 hwnd AS DWORD ' HWND // window to draw to
 hdc AS DWORD ' HDC // HDC to draw to
 xDst AS LONG ' int // destination rectangle
 yDst AS LONG ' int
 dxDst AS LONG ' int
 dyDst AS LONG ' int
 lpbi AS BITMAPINFOHEADER PTR ' LPBITMAPINFOHEADER // format of frame to draw
 xSrc AS LONG ' int // source rectangle
 ySrc AS LONG ' int
 dxSrc AS LONG ' int
 dySrc AS LONG ' int
 dwRate AS DWORD ' DWORD // frames/second = (dwRate/dwScale)
 dwScale AS DWORD
END TYPE
MACRO tagICDRAWBEGIN = ICDRAWBEGIN_STRUCT
'/************************************************************************
'************************************************************************/
%EQUATE `ICDRAW_HURRYUP = &H80000000 ' // don't draw just buffer (hurry up!)
%EQUATE `ICDRAW_UPDATE = &H40000000 ' // don't draw just update screen
%EQUATE `ICDRAW_PREROLL = &H20000000 ' // this frame is before real start
%EQUATE `ICDRAW_NULLFRAME = &H10000000 ' // repeat last frame
%EQUATE `ICDRAW_NOTKEYFRAME = &H08000000 ' // this frame is not a key frame
' // Size = 20 bytes
TYPE ICDRAW_STRUCT DWORD
 dwFlags AS DWORD ' DWORD // flags
 lpFormat AS DWORD ' LPVOID // format of frame to decompress
 lpData AS DWORD ' LPVOID // frame data to decompress
 cbData AS DWORD
 lTime AS LONG ' LONG // time in drawbegin units (see dwRate and dwScale)
END TYPE
MACRO tagICDRAW = ICDRAW_STRUCT
' // Size = 28 bytes
TYPE ICDRAWSUGGEST_STRUCT DWORD
 lpbiIn AS DWORD ' LPBITMAPINFOHEADER // format to be drawn
 lpbiSuggest AS DWORD ' LPBITMAPINFOHEADER // location for suggested format (or NULL to get size)
 dxSrc AS LONG ' int // source extent or 0
 dySrc AS LONG ' int
 dxDst AS LONG ' int // dest extent or 0
 dyDst AS LONG ' int
 hicDecompressor AS DWORD ' HIC// decompressor you can talk to
END TYPE
MACRO tagICDRAWSUGGEST = ICDRAWSUGGEST_STRUCT
'/************************************************************************
'************************************************************************/
' // Size = 16 bytes
TYPE ICPALETTE_STRUCT DWORD
 dwFlags AS DWORD ' DWORD // flags (from AVI index...)
 iStart AS LONG ' int // first palette to change
 iLen AS LONG ' int // count of entries to change.
 lppe AS PALETTEENTRY PTR ' PALETTEENTRY // palette
END TYPE
MACRO tagICPALETTE = ICPALETTE_STRUCT
'/************************************************************************
' ICM function declarations
'************************************************************************/
DECLARE FUNCTION ICInfo LIB "msvfw32.dll" ALIAS "ICInfo" ( BYVAL fccType AS QUAD , BYVAL fccHandler AS QUAD , BYREF lpicinfo AS ICINFO_STRUCT ) AS LONG
DECLARE FUNCTION ICInstall LIB "msvfw32.dll" ALIAS "ICInstall" ( BYVAl fccType AS QUAD
 , BYVAL fccHandler AS DWORD
 , BYVAL lParam AS LONG
 , BYREF szDesc AS ASCIIZ
 , BYVAL wFlags AS DWORD
 ) AS LONG
DECLARE FUNCTION ICRemove LIB "msvfw32.dll" ALIAS "ICRemove" ( BYVAl fccType AS DWORD
 , BYVAL fccHandler AS DWORD
 , BYVAL wFlags AS DWORD
 ) AS LONG
DECLARE FUNCTION ICGetInfo LIB "msvfw32.dll" ALIAS "ICGetInfo" ( BYVAL hic AS DWORD
 , BYREF picinfo AS ICINFO_STRUCT
 , BYVAL cb AS DWORD
 ) AS LONG ' LRESULT
DECLARE FUNCTION ICOpen LIB "msvfw32.dll" ALIAS "ICOpen" ( BYVAl fccType AS QUAD , BYVAL fccHandler AS QUAD , BYVAL wMode AS QUAD ) AS QUAD ' HIC
DECLARE FUNCTION ICOpenFunction LIB "msvfw32.dll" ALIAS "ICOpenFunction" ( BYVAl fccType AS QUAD , BYVAL fccHandler AS QUAD , BYVAL wMode AS QUAD , BYVAL lpfnHandler AS QUAD ) AS QUAD ' HIC
DECLARE FUNCTION ICClose LIB "msvfw32.dll" ALIAS "ICClose" ( BYVAL hic AS QUAD ) AS LONG ' LRESULT
DECLARE FUNCTION ICSendMessage LIB "msvfw32.dll" ALIAS "ICSendMessage" ( BYVAL hic AS QUAD , BYVAL msg AS QUAD , BYVAL dw1 AS QUAD , BYVAL dw2 AS QUAD ) AS LONG ' LRESULT
'#ifndef _WIN32
'//this function is unsupported on Win32 as it is non-portable.
'LRESULT VFWAPIV ICMessage(HIC hic, UINT msg, UINT cb, ...);
'#endif
'/* Values for wFlags of ICInstall() */
%EQUATE `ICINSTALL_UNICODE = &H8000
%EQUATE `ICINSTALL_FUNCTION = &H0001 ' // lParam is a DriverProc (function ptr)
%EQUATE `ICINSTALL_DRIVER = &H0002 ' // lParam is a driver name (string)
%EQUATE `ICINSTALL_HDRV = &H0004 ' // lParam is a HDRVR (driver handle)
%EQUATE `ICINSTALL_DRIVERW = &H8002 ' // lParam is a unicode driver name
'/************************************************************************
' query macros
'************************************************************************/
%EQUATE `ICMF_CONFIGURE_QUERY = &H00000001
%EQUATE `ICMF_ABOUT_QUERY = &H00000001
'#define ICQueryAbout(hic) \
' (ICSendMessage(hic, ICM_ABOUT, (DWORD_PTR) -1, ICMF_ABOUT_QUERY) == ICERR_OK)
FUNCTION ICQueryAbout (BYVAL hic AS DWORD) AS LONG
 FUNCTION = (ICSendMessage(hic, %ICM_ABOUT, -1, %ICMF_ABOUT_QUERY) = %ICERR_OK)
END FUNCTION
'#define ICAbout(hic, hwnd) \
' ICSendMessage(hic, ICM_ABOUT, (DWORD_PTR)(UINT_PTR)(hwnd), 0)
FUNCTION ICAbout (BYVAL hic AS DWORD, BYVAL hwnd AS DWORD) AS LONG
 FUNCTION = ICSendMessage(hic, %ICM_ABOUT, hwnd, 0)
END FUNCTION
'#define ICQueryConfigure(hic) \
' (ICSendMessage(hic, ICM_CONFIGURE, (DWORD_PTR) -1, ICMF_CONFIGURE_QUERY) == ICERR_OK)
FUNCTION ICQueryConfigure (BYVAL hic AS DWORD) AS LONG
 FUNCTION = (ICSendMessage(hic, %ICM_CONFIGURE, -1, %ICMF_CONFIGURE_QUERY) = %ICERR_OK)
END FUNCTION
'#define ICConfigure(hic, hwnd) \
' ICSendMessage(hic, ICM_CONFIGURE, (DWORD_PTR)(UINT_PTR)(hwnd), 0)
FUNCTION ICConfigure (BYVAL hic AS DWORD, BYVAL hwnd AS DWORD) AS LONG
 FUNCTION = ICSendMessage(hic, %ICM_CONFIGURE, hwnd, 0)
END FUNCTION
'/************************************************************************
' get/set state macros
'************************************************************************/
'#define ICGetState(hic, pv, cb) \
' ICSendMessage(hic, ICM_GETSTATE, (DWORD_PTR)(LPVOID)(pv), (DWORD_PTR)(cb))
FUNCTION ICGetState (BYVAL hic AS DWORD, BYVAL pv AS DWORD, BYVAL cb AS DWORD) AS LONG
 FUNCTION = (ICSendMessage(hic, %ICM_GETSTATE, pv, cb))
END FUNCTION
'#define ICSetState(hic, pv, cb) \
' ICSendMessage(hic, ICM_SETSTATE, (DWORD_PTR)(LPVOID)(pv), (DWORD_PTR)(cb))
FUNCTION ICSetState (BYVAL hic AS DWORD, BYVAL pv AS DWORD, BYVAL cb AS DWORD) AS LONG
 FUNCTION = (ICSendMessage(hic, %ICM_SETSTATE, pv, cb))
END FUNCTION
'#define ICGetStateSize(hic) \
' (DWORD) ICGetState(hic, NULL, 0)
FUNCTION ICGetStateSize (BYVAL hic AS DWORD) AS LONG
 FUNCTION = ICGetState(hic, %NULL, 0)
END FUNCTION
'/************************************************************************
' get value macros
'************************************************************************/
'static DWORD dwICValue;
'#define ICGetDefaultQuality(hic) \
' (ICSendMessage(hic, ICM_GETDEFAULTQUALITY, (DWORD_PTR)(LPVOID)&dwICValue, sizeof(DWORD)), dwICValue)
FUNCTION ICGetDefaultQuality (BYVAL hic AS DWORD) AS DWORD
 LOCAL dwICValue AS DWORD
 ICSendMessage(hic, %ICM_GETDEFAULTQUALITY, VARPTR(dwICValue), 4)
 FUNCTION = dwICValue
END FUNCTION
'#define ICGetDefaultKeyFrameRate(hic) \
' (ICSendMessage(hic, ICM_GETDEFAULTKEYFRAMERATE, (DWORD_PTR)(LPVOID)&dwICValue, sizeof(DWORD)), dwICValue)
FUNCTION ICGetDefaultKeyFrameRate (BYVAL hic AS DWORD) AS DWORD
 LOCAL dwICValue AS DWORD
 ICSendMessage(hic, %ICM_GETDEFAULTKEYFRAMERATE, VARPTR(dwICValue), 4)
 FUNCTION = dwICValue
END FUNCTION
'/************************************************************************
' draw window macro
'************************************************************************/
'#define ICDrawWindow(hic, prc) \
' ICSendMessage(hic, ICM_DRAW_WINDOW, (DWORD_PTR)(LPVOID)(prc), sizeof(RECT))
FUNCTION ICDrawWindow (BYVAL hic AS DWORD, BYREF prc AS RECT) AS LONG
 FUNCTION = ICSendMessage(hic, %ICM_DRAW_WINDOW, VARPTR(prc), SIZEOF(RECT))
END FUNCTION
'/************************************************************************
' compression functions
'************************************************************************/
'/*
' * ICCompress()
' *
' * compress a single frame
' *
' */
DECLARE FUNCTION ICCompress LIB "msvfw32.dll" ALIAS "ICCompress" ( BYVAL hic AS QUAD , BYVAL dwFlags AS QUAD , BYREF lpbiOutput AS BITMAPINFOHEADER , BYREF lpData AS ANY , BYREF lpbiInput AS BITMAPINFOHEADER , BYVAL lpBits AS QUAD , BYREF lpckid AS QUAD , BYREF lpdwFlags AS QUAD , BYVAL lFrameNum AS LONG , BYVAL dwFrameSize AS QUAD , BYVAL dwQuality AS QUAD , BYREF lpbiPrev AS BITMAPINFOHEADER , BYVAL lpPrev AS QUAD ) AS QUAD
'/*
' * ICCompressBegin()
' *
' * start compression from a source format (lpbiInput) to a dest
' * format (lpbiOuput) is supported.
' *
' */
'#define ICCompressBegin(hic, lpbiInput, lpbiOutput) \
' ICSendMessage(hic, ICM_COMPRESS_BEGIN, (DWORD_PTR)(LPVOID)(lpbiInput), (DWORD_PTR)(LPVOID)(lpbiOutput))
FUNCTION ICCompressBegin (BYVAL hic AS DWORD, BYREF lpbiInput AS BITMAPINFOHEADER, BYREF lpbiOutput AS BITMAPINFOHEADER) AS LONG
 FUNCTION = ICSendMessage(hic, %ICM_DRAW_WINDOW, VARPTR(lpbiInput), VARPTR(lpbiOutput))
END FUNCTION
'/*
' * ICCompressQuery()
' *
' * determines if compression from a source format (lpbiInput) to a dest
' * format (lpbiOuput) is supported.
' *
' */
'#define ICCompressQuery(hic, lpbiInput, lpbiOutput) \
' ICSendMessage(hic, ICM_COMPRESS_QUERY, (DWORD_PTR)(LPVOID)(lpbiInput), (DWORD_PTR)(LPVOID)(lpbiOutput))
FUNCTION ICCompressQuery (BYVAL hic AS DWORD, BYREF lpbiInput AS BITMAPINFOHEADER, BYREF lpbiOutput AS BITMAPINFOHEADER) AS LONG
 FUNCTION = ICSendMessage(hic, %ICM_COMPRESS_QUERY, VARPTR(lpbiInput), VARPTR(lpbiOutput))
END FUNCTION
'/*
' * ICCompressGetFormat()
' *
' * get the output format, (format of compressed data)
' * if lpbiOutput is NULL return the size in bytes needed for format.
' *
' */
'#define ICCompressGetFormat(hic, lpbiInput, lpbiOutput) \
' ICSendMessage(hic, ICM_COMPRESS_GET_FORMAT, (DWORD_PTR)(LPVOID)(lpbiInput), (DWORD_PTR)(LPVOID)(lpbiOutput))
FUNCTION ICCompressGetFormat (BYVAL hic AS DWORD, BYREF lpbiInput AS BITMAPINFOHEADER, BYREF lpbiOutput AS BITMAPINFOHEADER) AS LONG
 FUNCTION = ICSendMessage(hic, %ICM_COMPRESS_GET_FORMAT, VARPTR(lpbiInput), VARPTR(lpbiOutput))
END FUNCTION
'#define ICCompressGetFormatSize(hic, lpbi) \
' (DWORD) ICCompressGetFormat(hic, lpbi, NULL)
FUNCTION ICCompressGetFormatSize (BYVAL hic AS DWORD, BYREF lpbi AS BITMAPINFOHEADER) AS LONG
 FUNCTION = ICSendMessage(hic, %ICM_COMPRESS_GET_FORMAT, VARPTR(lpbi), %NULL)
END FUNCTION
'/*
' * ICCompressSize()
' *
' * return the maximal size of a compressed frame
' *
' */
'#define ICCompressGetSize(hic, lpbiInput, lpbiOutput) \
' (DWORD) ICSendMessage(hic, ICM_COMPRESS_GET_SIZE, (DWORD_PTR)(LPVOID)(lpbiInput), (DWORD_PTR)(LPVOID)(lpbiOutput))
FUNCTION ICCompressGetSize (BYVAL hic AS DWORD, BYREF lpbiInput AS BITMAPINFOHEADER, BYREF lpbiOutput AS BITMAPINFOHEADER) AS LONG
 FUNCTION = ICSendMessage(hic, %ICM_COMPRESS_GET_SIZE, VARPTR(lpbiInput), VARPTR(lpbiOutput))
END FUNCTION
'#define ICCompressEnd(hic) \
' ICSendMessage(hic, ICM_COMPRESS_END, 0, 0)
FUNCTION ICCompressEnd (BYVAL hic AS DWORD) AS LONG
 FUNCTION = ICSendMessage(hic, %ICM_COMPRESS_END, 0, 0)
END FUNCTION
'/************************************************************************
' decompression functions
'************************************************************************/
'/*
' * ICDecompress()
' *
' * decompress a single frame
' *
' */
%EQUATE `ICDECOMPRESS_HURRYUP = &H80000000 ' // don't draw just buffer (hurry up!)
DECLARE FUNCTION ICDecompress LIB "msvfw32.dll" ALIAS "ICDecompress" ( BYVAL hic AS QUAD , BYVAL dwFlags AS QUAD , BYREF lpbiFormat AS BITMAPINFOHEADER , BYVAL lpData AS QUAD , BYREF lpbi AS BITMAPINFOHEADER , BYREF lpBits AS ANY ) AS QUAD
'/*
' * ICDecompressBegin()
' *
' * start compression from a source format (lpbiInput) to a dest
' * format (lpbiOutput) is supported.
' *
' */
'#define ICDecompressBegin(hic, lpbiInput, lpbiOutput) \
' ICSendMessage(hic, ICM_DECOMPRESS_BEGIN, (DWORD_PTR)(LPVOID)(lpbiInput), (DWORD_PTR)(LPVOID)(lpbiOutput))
FUNCTION ICDecompressBegin (BYVAL hic AS DWORD, BYREF lpbiInput AS BITMAPINFOHEADER, BYREF lpbiOutput AS BITMAPINFOHEADER) AS LONG
 FUNCTION = ICSendMessage(hic, %ICM_DECOMPRESS_BEGIN, VARPTR(lpbiInput), VARPTR(lpbiOutput))
END FUNCTION
'/*
' * ICDecompressQuery()
' *
' * determines if compression from a source format (lpbiInput) to a dest
' * format (lpbiOutput) is supported.
' *
' */
'#define ICDecompressQuery(hic, lpbiInput, lpbiOutput) \
' ICSendMessage(hic, ICM_DECOMPRESS_QUERY, (DWORD_PTR)(LPVOID)(lpbiInput), (DWORD_PTR)(LPVOID)(lpbiOutput))
FUNCTION ICDecompressQuery (BYVAL hic AS DWORD, BYREF lpbiInput AS BITMAPINFOHEADER, BYREF lpbiOutput AS BITMAPINFOHEADER) AS LONG
 FUNCTION = ICSendMessage(hic, %ICM_DECOMPRESS_QUERY, VARPTR(lpbiInput), VARPTR(lpbiOutput))
END FUNCTION
'/*
' * ICDecompressGetFormat()
' *
' * get the output format, (format of un-compressed data)
' * if lpbiOutput is NULL return the size in bytes needed for format.
' *
' */
'#define ICDecompressGetFormat(hic, lpbiInput, lpbiOutput) \
' ((LONG) ICSendMessage(hic, ICM_DECOMPRESS_GET_FORMAT, (DWORD_PTR)(LPVOID)(lpbiInput), (DWORD_PTR)(LPVOID)(lpbiOutput)))
FUNCTION ICDecompressGetFormat (BYVAL hic AS DWORD, BYREF lpbiInput AS BITMAPINFOHEADER, BYREF lpbiOutput AS BITMAPINFOHEADER) AS LONG
 FUNCTION = ICSendMessage(hic, %ICM_DECOMPRESS_GET_FORMAT, VARPTR(lpbiInput), VARPTR(lpbiOutput))
END FUNCTION
'#define ICDecompressGetFormatSize(hic, lpbi) \
' ICDecompressGetFormat(hic, lpbi, NULL)
FUNCTION ICDecompressGetFormatSize (BYVAL hic AS DWORD, BYREF lpbi AS BITMAPINFOHEADER) AS LONG
 FUNCTION = ICDecompressGetFormat(hic, lpbi, BYVAL %NULL)
END FUNCTION
'/*
' * ICDecompressGetPalette()
' *
' * get the output palette
' *
' */
'#define ICDecompressGetPalette(hic, lpbiInput, lpbiOutput) \
' ICSendMessage(hic, ICM_DECOMPRESS_GET_PALETTE, (DWORD_PTR)(LPVOID)(lpbiInput), (DWORD_PTR)(LPVOID)(lpbiOutput))
FUNCTION ICDecompressGetPalette (BYVAL hic AS DWORD, BYREF lpbiInput AS BITMAPINFOHEADER, BYREF lpbiOutput AS BITMAPINFOHEADER) AS LONG
 FUNCTION = ICSendMessage(hic, %ICM_DECOMPRESS_GET_PALETTE, VARPTR(lpbiInput), VARPTR(lpbiOutput))
END FUNCTION
'#define ICDecompressSetPalette(hic, lpbiPalette) \
' ICSendMessage(hic, ICM_DECOMPRESS_SET_PALETTE, (DWORD_PTR)(LPVOID)(lpbiPalette), 0)
FUNCTION ICDecompressSetPalette (BYVAL hic AS DWORD, BYREF lpbiPalette AS BITMAPINFOHEADER) AS LONG
 FUNCTION = ICSendMessage(hic, %ICM_DECOMPRESS_SET_PALETTE, VARPTR(lpbiPalette), 0)
END FUNCTION
'#define ICDecompressEnd(hic) \
' ICSendMessage(hic, ICM_DECOMPRESS_END, 0, 0)
FUNCTION ICDecompressEnd (BYVAL hic AS DWORD) AS LONG
 FUNCTION = ICSendMessage(hic, %ICM_DECOMPRESS_END, 0, 0)
END FUNCTION
'/************************************************************************
' decompression (ex) functions
'************************************************************************/
'//
'// on Win16 these functions are macros that call ICMessage. ICMessage will
'// not work on NT. rather than add new entrypoints we have given
'// them as static inline functions
'//
'/*
' * ICDecompressEx()
' *
' * decompress a single frame
' *
' */
'static __inline LRESULT VFWAPI_INLINE
'ICDecompressEx(
' HIC hic,
' DWORD dwFlags,
' LPBITMAPINFOHEADER lpbiSrc,
' LPVOID lpSrc,
' int xSrc,
' int ySrc,
' int dxSrc,
' int dySrc,
' LPBITMAPINFOHEADER lpbiDst,
' LPVOID lpDst,
' int xDst,
' int yDst,
' int dxDst,
' int dyDst)
'{
' ICDECOMPRESSEX ic;
' ic.dwFlags = dwFlags;
' ic.lpbiSrc = lpbiSrc;
' ic.lpSrc = lpSrc;
' ic.xSrc = xSrc;
' ic.ySrc = ySrc;
' ic.dxSrc = dxSrc;
' ic.dySrc = dySrc;
' ic.lpbiDst = lpbiDst;
' ic.lpDst = lpDst;
' ic.xDst = xDst;
' ic.yDst = yDst;
' ic.dxDst = dxDst;
' ic.dyDst = dyDst;
' // note that ICM swaps round the length and pointer
' // length in lparam2, pointer in lparam1
' return ICSendMessage(hic, ICM_DECOMPRESSEX, (DWORD_PTR)&ic, sizeof(ic));
'}
FUNCTION ICDecompressEx ( BYVAL hic AS DWORD, ' HIC hic
 BYVAL dwFlags AS DWORD, ' DWORD dwFlags
 BYREF lpbiSrc AS BITMAPINFOHEADER, ' LPBITMAPINFOHEADER lpbiSrc,
 BYVAL lpSrc AS DWORD, ' LPVOID lpSrc
 BYVAL xSrc AS LONG, ' int xSrc
 BYVAL ySrc AS LONG, ' int ySrc
 BYVAL dxSrc AS LONG, ' int dxSrc
 BYVAL dySrc AS LONG, ' int dySrc
 BYREF lpbiDst AS BITMAPINFOHEADER, ' LPBITMAPINFOHEADER lpbiDst
 BYVAL lpDst AS DWORD, ' LPVOID lpDst
 BYVAL xDst AS LONG, ' int xDst
 BYVAL yDst AS LONG, ' int yDst
 BYVAL dxDst AS LONG, ' int dxDst
 BYVAL dyDst AS LONG ' int dyDst
 ) AS LONG ' LRESULT
 LOCAL ic AS ICDECOMPRESSEX_STRUCT
 ic.dwFlags = dwFlags
 ic.lpbiSrc = VARPTR(lpbiSrc)
 ic.lpSrc = lpSrc
 ic.xSrc = xSrc
 ic.ySrc = ySrc
 ic.dxSrc = dxSrc
 ic.dySrc = dySrc
 ic.lpbiDst = VARPTR(lpbiDst)
 ic.lpDst = lpDst
 ic.xDst = xDst
 ic.yDst = yDst
 ic.dxDst = dxDst
 ic.dyDst = dyDst
 ' // note that ICM swaps round the length and pointer
 ' // length in lparam2, pointer in lparam1
 FUNCTION = ICSendMessage(hic, %ICM_DECOMPRESSEX, VARPTR(ic), sizeof(ic))
END FUNCTION
'/*
' * ICDecompressExBegin()
' *
' * start compression from a source format (lpbiInput) to a dest
' * format (lpbiOutput) is supported.
' *
' */
'static __inline LRESULT VFWAPI_INLINE
'ICDecompressExBegin(
' HIC hic,
' DWORD dwFlags,
' LPBITMAPINFOHEADER lpbiSrc,
' LPVOID lpSrc,
' int xSrc,
' int ySrc,
' int dxSrc,
' int dySrc,
' LPBITMAPINFOHEADER lpbiDst,
' LPVOID lpDst,
' int xDst,
' int yDst,
' int dxDst,
' int dyDst)
'{
' ICDECOMPRESSEX ic;
' ic.dwFlags = dwFlags;
' ic.lpbiSrc = lpbiSrc;
' ic.lpSrc = lpSrc;
' ic.xSrc = xSrc;
' ic.ySrc = ySrc;
' ic.dxSrc = dxSrc;
' ic.dySrc = dySrc;
' ic.lpbiDst = lpbiDst;
' ic.lpDst = lpDst;
' ic.xDst = xDst;
' ic.yDst = yDst;
' ic.dxDst = dxDst;
' ic.dyDst = dyDst;
' // note that ICM swaps round the length and pointer
' // length in lparam2, pointer in lparam1
' return ICSendMessage(hic, ICM_DECOMPRESSEX_BEGIN, (DWORD_PTR)&ic, sizeof(ic));
'}
FUNCTION ICDecompressExBegin ( BYVAL hic AS DWORD, ' HIC hic
 BYVAL dwFlags AS DWORD, ' DWORD dwFlags
 BYREF lpbiSrc AS BITMAPINFOHEADER, ' LPBITMAPINFOHEADER lpbiSrc
 BYVAL lpSrc AS DWORD, ' LPVOID lpSrc
 BYVAL xSrc AS LONG, ' int xSrc
 BYVAL ySrc AS LONG, ' int ySrc
 BYVAL dxSrc AS LONG, ' int dxSrc
 BYVAL dySrc AS LONG, ' int dySrc
 BYREF lpbiDst AS BITMAPINFOHEADER, ' LPBITMAPINFOHEADER lpbiDst
 BYVAL lpDst AS DWORD, ' LPVOID lpDst
 BYVAL xDst AS LONG, ' int xDst
 BYVAL yDst AS LONG, ' int yDst
 BYVAL dxDst AS LONG, ' int dxDst
 BYVAL dyDst AS LONG ' int dyDst
 ) AS LONG ' LRESULT
 LOCAL ic AS ICDECOMPRESSEX_STRUCT
 ic.dwFlags = dwFlags
 ic.lpbiSrc = VARPTR(lpbiSrc)
 ic.lpSrc = lpSrc
 ic.xSrc = xSrc
 ic.ySrc = ySrc
 ic.dxSrc = dxSrc
 ic.dySrc = dySrc
 ic.lpbiDst = VARPTR(lpbiDst)
 ic.lpDst = lpDst
 ic.xDst = xDst
 ic.yDst = yDst
 ic.dxDst = dxDst
 ic.dyDst = dyDst
 ' // note that ICM swaps round the length and pointer
 ' // length in lparam2, pointer in lparam1
 FUNCTION = ICSendMessage(hic, %ICM_DECOMPRESSEX_BEGIN, VARPTR(ic), sizeof(ic))
END FUNCTION
'/*
' * ICDecompressExQuery()
' *
' */
'static __inline LRESULT VFWAPI_INLINE
'ICDecompressExQuery(
' HIC hic,
' DWORD dwFlags,
' LPBITMAPINFOHEADER lpbiSrc,
' LPVOID lpSrc,
' int xSrc,
' int ySrc,
' int dxSrc,
' int dySrc,
' LPBITMAPINFOHEADER lpbiDst,
' LPVOID lpDst,
' int xDst,
' int yDst,
' int dxDst,
' int dyDst)
'{
' ICDECOMPRESSEX ic;
' ic.dwFlags = dwFlags;
' ic.lpbiSrc = lpbiSrc;
' ic.lpSrc = lpSrc;
' ic.xSrc = xSrc;
' ic.ySrc = ySrc;
' ic.dxSrc = dxSrc;
' ic.dySrc = dySrc;
' ic.lpbiDst = lpbiDst;
' ic.lpDst = lpDst;
' ic.xDst = xDst;
' ic.yDst = yDst;
' ic.dxDst = dxDst;
' ic.dyDst = dyDst;
' // note that ICM swaps round the length and pointer
' // length in lparam2, pointer in lparam1
' return ICSendMessage(hic, ICM_DECOMPRESSEX_QUERY, (DWORD_PTR)&ic, sizeof(ic));
'}
FUNCTION ICDecompressExQuery ( BYVAL hic AS DWORD, ' HIC hic
 BYVAL dwFlags AS DWORD, ' DWORD dwFlags
 BYREF lpbiSrc AS BITMAPINFOHEADER, ' LPBITMAPINFOHEADER lpbiSrc
 BYVAL lpSrc AS DWORD, ' LPVOID lpSrc
 BYVAL xSrc AS LONG, ' int xSrc
 BYVAL ySrc AS LONG, ' int ySrc
 BYVAL dxSrc AS LONG, ' int dxSrc
 BYVAL dySrc AS LONG, ' int dySrc
 BYREF lpbiDst AS BITMAPINFOHEADER, ' LPBITMAPINFOHEADER lpbiDst
 BYVAL lpDst AS DWORD, ' LPVOID lpDst
 BYVAL xDst AS LONG, ' int xDst
 BYVAL yDst AS LONG, ' int yDst
 BYVAL dxDst AS LONG, ' int dxDst
 BYVAL dyDst AS LONG ' int dyDst
 ) AS LONG ' LRESULT
 LOCAL ic AS ICDECOMPRESSEX_STRUCT
 ic.dwFlags = dwFlags
 ic.lpbiSrc = VARPTR(lpbiSrc)
 ic.lpSrc = lpSrc
 ic.xSrc = xSrc
 ic.ySrc = ySrc
 ic.dxSrc = dxSrc
 ic.dySrc = dySrc
 ic.lpbiDst = VARPTR(lpbiDst)
 ic.lpDst = lpDst
 ic.xDst = xDst
 ic.yDst = yDst
 ic.dxDst = dxDst
 ic.dyDst = dyDst
 ' // note that ICM swaps round the length and pointer
 ' // length in lparam2, pointer in lparam1
 FUNCTION = ICSendMessage(hic, %ICM_DECOMPRESSEX_QUERY, VARPTR(ic), sizeof(ic))
END FUNCTION
'#define ICDecompressExEnd(hic) \
' ICSendMessage(hic, ICM_DECOMPRESSEX_END, 0, 0)
FUNCTION ICDecompressExEnd (BYVAL hic AS DWORD) AS LONG
 FUNCTION = ICSendMessage(hic, %ICM_DECOMPRESSEX_END, 0, 0)
END FUNCTION
'/************************************************************************
' drawing functions
'************************************************************************/
'/*
' * ICDrawBegin()
' *
' * start decompressing data with format (lpbiInput) directly to the screen
' *
' * return zero if the decompressor supports drawing.
' *
' */
%EQUATE `ICDRAW_QUERY = &H00000001 ' // test for support
%EQUATE `ICDRAW_FULLSCREEN = &H00000002 ' // draw to full screen
%EQUATE `ICDRAW_HDC = &H00000004 ' // draw to a HDC/HWND
DECLARE FUNCTION ICDrawBegin LIB "msvfw32.dll" ALIAS "ICDrawBegin" ( BYVAL hic AS QUAD , BYVAL dwFlags AS QUAD , BYVAL hpal AS QUAD , BYVAL hwnd AS QUAD , BYVAL hdc AS QUAD , BYVAL xDst AS LONG , BYVAL yDst AS LONG , BYVAL dxDst AS LONG , BYVAL dyDst AS LONG , BYREF lpbi AS BITMAPINFOHEADER , BYVAL xSrc AS LONG , BYVAL ySrc AS LONG , BYVAL dxSrc AS LONG , BYVAL dySrc AS LONG , BYVAL dwRate AS QUAD , BYVAL dwScale AS QUAD ) AS QUAD
'/*
' * ICDraw()
' *
' * decompress data directly to the screen
' *
' */
%EQUATE `ICDRAW_HURRYUP = &H80000000 ' // don't draw just buffer (hurry up!)
%EQUATE `ICDRAW_UPDATE = &H40000000 ' // don't draw just update screen
DECLARE FUNCTION ICDraw LIB "msvfw32.dll" ALIAS "ICDraw" ( BYVAL hic AS QUAD , BYVAL dwFlags AS QUAD , BYVAL lpFormat AS QUAD , BYVAL lpData AS QUAD , BYVAL cb AS QUAD , BYVAL lTime AS LONG ) AS QUAD
'// ICMessage is not supported on Win32, so provide a static inline function
'// to do the same job
'static __inline LRESULT VFWAPI_INLINE
'ICDrawSuggestFormat(
' HIC hic,
' LPBITMAPINFOHEADER lpbiIn,
' LPBITMAPINFOHEADER lpbiOut,
' int dxSrc,
' int dySrc,
' int dxDst,
' int dyDst,
' HIC hicDecomp)
'{
' ICDRAWSUGGEST ic;
' ic.lpbiIn = lpbiIn;
' ic.lpbiSuggest = lpbiOut;
' ic.dxSrc = dxSrc;
' ic.dySrc = dySrc;
' ic.dxDst = dxDst;
' ic.dyDst = dyDst;
' ic.hicDecompressor = hicDecomp;
' // note that ICM swaps round the length and pointer
' // length in lparam2, pointer in lparam1
' return ICSendMessage(hic, ICM_DRAW_SUGGESTFORMAT, (DWORD_PTR)&ic, sizeof(ic));
'}
FUNCTION ICDrawSuggestFormat ( BYVAL hic AS DWORD, ' HIC hic
 BYREF lpbiIn AS BITMAPINFOHEADER, ' LPBITMAPINFOHEADER lpbiIn
 BYREF lpbiOut AS BITMAPINFOHEADER, ' LPBITMAPINFOHEADER lpbiOut
 BYVAL dxSrc AS LONG, ' int dxSrc
 BYVAL dySrc AS LONG, ' int dySrc
 BYVAL dxDst AS LONG, ' int dxDst
 BYVAL dyDst AS LONG, ' int dyDst
 BYVAL hicDecomp AS DWORD ' HIC hicDecomp
 ) AS LONG ' LRESULT
 LOCAL ic AS ICDRAWSUGGEST_STRUCT
 ic.lpbiIn = VARPTR(lpbiIn)
 ic.lpbiSuggest = VARPTR(lpbiOut)
 ic.dxSrc = dxSrc
 ic.dySrc = dySrc
 ic.dxDst = dxDst
 ic.dyDst = dyDst
 ic.hicDecompressor = hicDecomp
 ' // note that ICM swaps round the length and pointer
 ' // length in lparam2, pointer in lparam1
 FUNCTION = ICSendMessage(hic, %ICM_DRAW_SUGGESTFORMAT, VARPTR(ic), sizeof(ic))
END FUNCTION
'/*
' * ICDrawQuery()
' *
' * determines if the compressor is willing to render the specified format.
' *
' */
'#define ICDrawQuery(hic, lpbiInput) \
' ICSendMessage(hic, ICM_DRAW_QUERY, (DWORD_PTR)(LPVOID)(lpbiInput), 0L)
FUNCTION ICDrawQuery (BYVAL hic AS DWORD, BYREF lpbiInput AS BITMAPINFOHEADER) AS LONG
 FUNCTION = ICSendMessage(hic, %ICM_DRAW_QUERY, VARPTR(lpbiInput), 0)
END FUNCTION
'#define ICDrawChangePalette(hic, lpbiInput) \
' ICSendMessage(hic, ICM_DRAW_CHANGEPALETTE, (DWORD_PTR)(LPVOID)(lpbiInput), 0L)
FUNCTION ICDrawChangePalette (BYVAL hic AS DWORD, BYREF lpbiInput AS BITMAPINFOHEADER) AS LONG
 FUNCTION = ICSendMessage(hic, %ICM_DRAW_CHANGEPALETTE, VARPTR(lpbiInput), 0)
END FUNCTION
'#define ICGetBuffersWanted(hic, lpdwBuffers) \
' ICSendMessage(hic, ICM_GETBUFFERSWANTED, (DWORD_PTR)(LPVOID)(lpdwBuffers), 0)
FUNCTION ICGetBuffersWanted (BYVAL hic AS DWORD, BYREF lpdwBuffers AS DWORD) AS LONG
 FUNCTION = ICSendMessage(hic, %ICM_GETBUFFERSWANTED, VARPTR(lpdwBuffers), 0)
END FUNCTION
'#define ICDrawEnd(hic) \
' ICSendMessage(hic, ICM_DRAW_END, 0, 0)
FUNCTION ICDrawEnd (BYVAL hic AS DWORD) AS LONG
 FUNCTION = ICSendMessage(hic, %ICM_DRAW_END, 0, 0)
END FUNCTION
'#define ICDrawStart(hic) \
' ICSendMessage(hic, ICM_DRAW_START, 0, 0)
FUNCTION ICDrawStart (BYVAL hic AS DWORD) AS LONG
 FUNCTION = ICSendMessage(hic, %ICM_DRAW_START, 0, 0)
END FUNCTION
'#define ICDrawStartPlay(hic, lFrom, lTo) \
' ICSendMessage(hic, ICM_DRAW_START_PLAY, (DWORD_PTR)(lFrom), (DWORD_PTR)(lTo))
FUNCTION ICDrawStartPlay (BYVAL hic AS DWORD, BYVAL lFrom AS LONG, BYVAL lTo AS LONG) AS LONG
 FUNCTION = ICSendMessage(hic, %ICM_DRAW_START_PLAY, lFrom, lTo)
END FUNCTION
'#define ICDrawStop(hic) \
' ICSendMessage(hic, ICM_DRAW_STOP, 0, 0)
FUNCTION ICDrawStop (BYVAL hic AS DWORD) AS LONG
 FUNCTION = ICSendMessage(hic, %ICM_DRAW_STOP, 0, 0)
END FUNCTION
'#define ICDrawStopPlay(hic) \
' ICSendMessage(hic, ICM_DRAW_STOP_PLAY, 0, 0)
FUNCTION ICDrawStopPlay (BYVAL hic AS DWORD) AS LONG
 FUNCTION = ICSendMessage(hic, %ICM_DRAW_STOP_PLAY, 0, 0)
END FUNCTION
'#define ICDrawGetTime(hic, lplTime) \
' ICSendMessage(hic, ICM_DRAW_GETTIME, (DWORD_PTR)(LPVOID)(lplTime), 0)
FUNCTION ICDrawGetTime (BYVAL hic AS DWORD, BYREF lplTime AS DWORD) AS LONG
 FUNCTION = ICSendMessage(hic, %ICM_DRAW_GETTIME, VARPTR(lplTime), 0)
END FUNCTION
'#define ICDrawSetTime(hic, lTime) \
' ICSendMessage(hic, ICM_DRAW_SETTIME, (DWORD_PTR)lTime, 0)
FUNCTION ICDrawSetTime (BYVAL hic AS DWORD, BYVAL lTime AS DWORD) AS LONG
 FUNCTION = ICSendMessage(hic, %ICM_DRAW_SETTIME, lTime, 0)
END FUNCTION
'#define ICDrawRealize(hic, hdc, fBackground) \
' ICSendMessage(hic, ICM_DRAW_REALIZE, (DWORD_PTR)(UINT_PTR)(HDC)(hdc), (DWORD_PTR)(BOOL)(fBackground))
FUNCTION ICDrawRealize (BYVAL hic AS DWORD, BYVAL hdc AS DWORD, BYVAL fBackground AS LONG) AS LONG
 FUNCTION = ICSendMessage(hic, %ICM_DRAW_SETTIME, hdc, fBackground)
END FUNCTION
'#define ICDrawFlush(hic) \
' ICSendMessage(hic, ICM_DRAW_FLUSH, 0, 0)
FUNCTION ICDrawFlush (BYVAL hic AS DWORD) AS LONG
 FUNCTION = ICSendMessage(hic, %ICM_DRAW_FLUSH, 0, 0)
END FUNCTION
'#define ICDrawRenderBuffer(hic) \
' ICSendMessage(hic, ICM_DRAW_RENDERBUFFER, 0, 0)
FUNCTION ICDrawRenderBuffer (BYVAL hic AS DWORD) AS LONG
 FUNCTION = ICSendMessage(hic, %ICM_DRAW_RENDERBUFFER, 0, 0)
END FUNCTION
'/************************************************************************
' Status callback functions
'************************************************************************/
'/*
' * ICSetStatusProc()
' *
' * Set the status callback function
' *
' */
'// ICMessage is not supported on NT
'static __inline LRESULT VFWAPI_INLINE
'ICSetStatusProc(
' HIC hic,
' DWORD dwFlags,
' LRESULT lParam,
' LONG (CALLBACK *fpfnStatus)(LPARAM, UINT, LONG) )
'{
' ICSETSTATUSPROC ic;
' ic.dwFlags = dwFlags;
' ic.lParam = lParam;
' ic.Status = fpfnStatus;
' // note that ICM swaps round the length and pointer
' // length in lparam2, pointer in lparam1
' return ICSendMessage(hic, ICM_SET_STATUS_PROC, (DWORD_PTR)&ic, sizeof(ic));
'}
FUNCTION ICSetStatusProc ( BYVAL hic AS DWORD, ' HIC hic
 BYVAL dwFLags AS DWORD, ' DWORD dwFlags
 BYVAL lParam AS LONG, ' LRESULT lParam
 BYVAL fpfnStatus AS DWORD ' LONG (CALLBACK *fpfnStatus)(LPARAM, UINT, LONG) )
 ) AS LONG ' LRESULT
 LOCAL ic AS ICSETSTATUSPROC_STRUCT
 ic.dwFlags = dwFlags
 ic.lParam = lParam
 ic.Status = fpfnStatus
 ' // note that ICM swaps round the length and pointer
 ' // length in lparam2, pointer in lparam1
 FUNCTION = ICSendMessage(hic, %ICM_SET_STATUS_PROC, VARPTR(ic), sizeof(ic))
END FUNCTION
'/************************************************************************
'helper routines for DrawDib and MCIAVI...
'************************************************************************/
DECLARE FUNCTION ICLocate LIB "msvfw32.dll" ALIAS "ICLocate" ( BYVAl fccType AS QUAD , BYVAL fccHandler AS QUAD , BYREF lpbiIn AS BITMAPINFOHEADER , BYREF lpbiOut AS BITMAPINFOHEADER , BYVAL wFlags AS WORD ) AS QUAD ' HIC
'#define ICDecompressOpen(fccType, fccHandler, lpbiIn, lpbiOut) \
' ICLocate(fccType, fccHandler, lpbiIn, lpbiOut, ICMODE_DECOMPRESS)
FUNCTION ICDecompressOpen (BYVAL fccType AS DWORD, BYVAL fccHandler AS DWORD, BYREF lpbiIn AS BITMAPINFOHEADER, BYREF lpbiOut AS BITMAPINFOHEADER) AS DWORD
 FUNCTION = ICLocate(fccType, fccHandler, lpbiIn, lpbiOut, %ICMODE_DECOMPRESS)
END FUNCTION
'#define ICDrawOpen(fccType, fccHandler, lpbiIn) \
' ICLocate(fccType, fccHandler, lpbiIn, NULL, ICMODE_DRAW)
FUNCTION ICDrawOpen (BYVAL fccType AS DWORD, BYVAL fccHandler AS DWORD, BYREF lpbiIn AS BITMAPINFOHEADER) AS DWORD
 FUNCTION = ICLocate(fccType, fccHandler, lpbiIn, BYVAL %NULL, %ICMODE_DRAW)
END FUNCTION
DECLARE FUNCTION ICGetDisplayFormat LIB "msvfw32.dll" ALIAS "ICGetDisplayFormat" ( BYVAL hic AS QUAD , BYREF lpbiIn AS BITMAPINFOHEADER , BYREF lpbiOut AS BITMAPINFOHEADER , BYVAL BitDepth AS LONG , BYVAL dx AS LONG , BYVAL dy AS LONG ) AS QUAD ' HIC
'/************************************************************************
'Higher level functions
'************************************************************************/
DECLARE FUNCTION ICImageCompress LIB "msvfw32.dll" ALIAS "ICImageCompress" ( BYVAL hic AS QUAD , BYVAL uiFlags AS QUAD , BYREF lpbiIn AS BITMAPINFOHEADER , BYVAL lpBits AS QUAD , BYREF lpbiOut AS BITMAPINFOHEADER , BYVAL lQuality AS LONG , BYREF plSize AS LONG ) AS QUAD
DECLARE FUNCTION ICImageDecompress LIB "msvfw32.dll" ALIAS "ICImageDecompress" ( BYVAL hic AS QUAD
 , BYVAL uiFlags AS DWORD
 , BYREF lpbiIn AS BITMAPINFOHEADER
 , BYVAL lpBits AS DWORD
 , BYREF lpbiOut AS BITMAPINFOHEADER
 ) AS DWORD
'//
'// Structure used by ICSeqCompressFrame and ICCompressorChoose routines
'// Make sure this matches the autodoc in icm.c!
'//
' // Size = 64 bytes
TYPE COMPVARS DWORD
 cbSize AS LONG ' LONG // set to sizeof(COMPVARS) before
 ' // calling ICCompressorChoose
 dwFlags AS DWORD ' DWORD // see below...
 hic AS DWORD ' HIC // HIC of chosen compressor
 fccType AS DWORD ' DWORD // basically ICTYPE_VIDEO
 fccHandler AS DWORD ' DWORD // handler of chosen compressor or
 ' // "" or "DIB "
 lpbiIn AS BITMAPINFO PTR ' LPBITMAPINFO // input format
 lpbiOut AS BITMAPINFO PTR ' LPBITMAPINFO // output format - will compress to this
 lpBitsOut AS DWORD
 lpBitsPrev AS DWORD
 lFrame AS LONG
 lKey AS LONG ' LONG // key frames how often?
 lDataRate AS LONG ' LONG // desired data rate KB/Sec
 lQ AS LONG ' LONG // desired quality
 lKeyCount AS LONG
 lpState AS DWORD ' LPVOID // state of compressor
 cbState AS LONG ' LONG // size of the state
END TYPE
'// FLAGS for dwFlags element of COMPVARS structure:
'// set this flag if you initialize COMPVARS before calling ICCompressorChoose
%EQUATE `ICMF_COMPVARS_VALID = &H00000001 ' // COMPVARS contains valid data
'//
'// allows user to choose compressor, quality etc...
'//
DECLARE FUNCTION ICCompressorChoose LIB "msvfw32.dll" ALIAS "ICCompressorChoose" ( BYVAL hwnd AS QUAD , BYVAL uiFlags AS QUAD , BYVAL pvIn AS QUAD , BYVAL lpData AS QUAD , BYREF pc AS COMPVARS , BYREF lpszTitle AS ASCIIZ ) AS LONG
'// defines for uiFlags
%EQUATE `ICMF_CHOOSE_KEYFRAME = &H0001 ' // show KeyFrame Every box
%EQUATE `ICMF_CHOOSE_DATARATE = &H0002 ' // show DataRate box
%EQUATE `ICMF_CHOOSE_PREVIEW = &H0004 ' // allow expanded preview dialog
%EQUATE `ICMF_CHOOSE_ALLCOMPRESSORS = &H0008 ' // don't only show those that
 ' // can handle the input format
 ' // or input data
DECLARE FUNCTION ICSeqCompressFrameStart LIB "msvfw32.dll" ALIAS "ICSeqCompressFrameStart" ( BYREF pc AS COMPVARS , BYREF lpbiIn AS BITMAPINFO ) AS LONG
DECLARE SUB ICSeqCompressFrameEnd LIB "msvfw32.dll" ALIAS "ICSeqCompressFrameEnd" ( BYREF pc AS COMPVARS
 ) ' void
DECLARE SUB ICSeqCompressFrame LIB "msvfw32.dll" ALIAS "ICSeqCompressFrame" ( BYREF pc AS COMPVARS , BYVAL uiFlags AS QUAD , BYVAL lpBits AS QUAD , BYREF pfKey AS LONG , BYREF plSize AS LONG ) ' void
DECLARE SUB ICCompressorFree LIB "msvfw32.dll" ALIAS "ICCompressorFree" ( BYREF pc AS COMPVARS ) ' void
#ENDIF ' /* NOCOMPMAN */ ---------------------------------------------------------------
'/**************************************************************************
' *
' * DRAWDIB - Routines for drawing to the display.
' *
' *************************************************************************/
#IF NOT %DEF(%NODRAWDIB) ' ---------------------------------------------------------------
'typedef HANDLE HDRAWDIB; /* hdd */
'/*********************************************************************
' DrawDib Flags
'**********************************************************************/
%EQUATE `DDF_0001 = &H0001 ' /* ;Internal *' /
%EQUATE `DDF_UPDATE = &H0002 ' /* re-draw the last DIB *' /
%EQUATE `DDF_SAME_HDC = &H0004 ' /* HDC same as last call (all setup) *' /
%EQUATE `DDF_SAME_DRAW = &H0008 ' /* draw params are the same *' /
%EQUATE `DDF_DONTDRAW = &H0010 ' /* dont draw frame, just decompress *' /
%EQUATE `DDF_ANIMATE = &H0020 ' /* allow palette animation *' /
%EQUATE `DDF_BUFFER = &H0040 ' /* always buffer image *' /
%EQUATE `DDF_JUSTDRAWIT = &H0080 ' /* just draw it with GDI *' /
%EQUATE `DDF_FULLSCREEN = &H0100 ' /* use DisplayDib *' /
%EQUATE `DDF_BACKGROUNDPAL = &H0200 ' /* Realize palette in background *' /
%EQUATE `DDF_NOTKEYFRAME = &H0400 ' /* this is a partial frame update, hint *' /
%EQUATE `DDF_HURRYUP = &H0800 ' /* hurry up please! *' /
%EQUATE `DDF_HALFTONE = &H1000 ' /* always halftone *' /
%EQUATE `DDF_2000 = &H2000 ' /* ;Internal *' /
%EQUATE `DDF_PREROLL = %DDF_DONTDRAW ' /* Builing up a non-keyframe *' /
%EQUATE `DDF_SAME_DIB = %DDF_SAME_DRAW
%EQUATE `DDF_SAME_SIZE = %DDF_SAME_DRAW
'/*********************************************************************
' DrawDib functions
'*********************************************************************/
'/* // ;Internal
'** DrawDibInit() // ;Internal
'** // ;Internal
'*/ // ;Internal
'extern BOOL VFWAPI DrawDibInit(void); // ;Internal
' // ;Internal
'/*
'** DrawDibOpen()
'**
'*/
DECLARE FUNCTION DrawDibOpen LIB "msvfw32.dll" ALIAS "DrawDibOpen"( ) AS QUAD ' HDRAWDIB
'/*
'** DrawDibClose()
'**
'*/
DECLARE FUNCTION DrawDibClose LIB "msvfw32.dll" ALIAS "DrawDibClose"( BYVAL hdd AS QUAD ) AS LONG
'/*
'** DrawDibGetBuffer()
'**
'*/
DECLARE FUNCTION DrawDibGetBuffer LIB "msvfw32.dll" ALIAS "DrawDibGetBuffer"( BYVAL hdd AS QUAD , BYREF lpbi AS BITMAPINFOHEADER , BYVAL dwSize AS QUAD , BYVAL dwFlags AS QUAD ) AS QUAD
'/* // ;Internal
'** DrawDibError() // ;Internal
'*/ // ;Internal
'extern UINT VFWAPI DrawDibError(HDRAWDIB hdd); // ;Internal
' // ;Internal
'/*
'** DrawDibGetPalette()
'**
'** get the palette used for drawing DIBs
'**
'*/
DECLARE FUNCTION DrawDibGetPalette LIB "msvfw32.dll" ALIAS "DrawDibGetPalette"( BYVAL hdd AS QUAD ) AS QUAD ' HPALETTE
'/*
'** DrawDibSetPalette()
'**
'** get the palette used for drawing DIBs
'**
'*/
DECLARE FUNCTION DrawDibSetPalette LIB "msvfw32.dll" ALIAS "DrawDibSetPalette"( BYVAL hdd AS QUAD , BYVAL hpal AS QUAD ) AS LONG
'/*
'** DrawDibChangePalette()
'*/
DECLARE FUNCTION DrawDibChangePalette LIB "msvfw32.dll" ALIAS "DrawDibChangePalette"( BYVAL hdd AS QUAD , BYVAL iStart AS LONG , BYVAL iLen AS LONG , BYREF lppe AS PALETTEENTRY ) AS LONG
'/*
'** DrawDibRealize()
'**
'** realize the palette in a HDD
'**
'*/
DECLARE FUNCTION DrawDibRealize LIB "msvfw32.dll" ALIAS "DrawDibRealize"( BYVAL hdd AS QUAD , BYVAL hdc AS QUAD , BYVAL fBackground AS LONG ) AS QUAD ' UINT
'/*
'** DrawDibStart()
'**
'** start of streaming playback
'**
'*/
DECLARE FUNCTION DrawDibStart LIB "msvfw32.dll" ALIAS "DrawDibStart"( BYVAL hdd AS QUAD , BYVAL rate AS QUAD ) AS LONG
'/*
'** DrawDibStop()
'**
'** start of streaming playback
'**
'*/
DECLARE FUNCTION DrawDibStop LIB "msvfw32.dll" ALIAS "DrawDibStop"( BYVAL hdd AS QUAD ) AS LONG
'/*
'** DrawDibBegin()
'**
'** prepare to draw
'**
'*/
DECLARE FUNCTION DrawDibBegin LIB "msvfw32.dll" ALIAS "DrawDibBegin"( BYVAL hdd AS QUAD , BYVAL hdc AS QUAD , BYVAL dxDst AS LONG , BYVAL dyDst AS LONG , BYREF lpbi AS BITMAPINFOHEADER , BYVAL dxSrc AS LONG , BYVAL dySrc AS LONG , BYVAL wFlags AS QUAD ) AS LONG
'/*
'** DrawDibDraw()
'**
'** actualy draw a DIB to the screen.
'**
'*/
DECLARE FUNCTION DrawDibDraw LIB "msvfw32.dll" ALIAS "DrawDibDraw"( BYVAL hdd AS QUAD , BYVAL hdc AS QUAD , BYVAL xDst AS LONG , BYVAL yDst AS LONG , BYVAL dxDst AS LONG , BYVAL dyDst AS LONG , BYREF lpbi AS BITMAPINFOHEADER , BYVAL lpBits AS QUAD , BYVAL xSrc AS LONG , BYVAL ySrc AS LONG , BYVAL dxSrc AS LONG , BYVAL dySrc AS LONG , BYVAL wFlags AS QUAD ) AS LONG
'/*
'** DrawDibUpdate()
'**
'** redraw the last image (may only be valid with DDF_BUFFER)
'*/
'#define DrawDibUpdate(hdd, hdc, x, y) \
' DrawDibDraw(hdd, hdc, x, y, 0, 0, NULL, NULL, 0, 0, 0, 0, DDF_UPDATE)
FUNCTION DrawDibUpdate ( BYVAL hdd AS DWORD, ' HDRAWDIB
 BYVAL hdc AS DWORD, ' HDC
 BYVAL x AS LONG, ' int
 BYVAL y AS LONG ' int
 ) AS LONG
 FUNCTION = DrawDibDraw(hdd, hdc, x, y, 0, 0, BYVAL %NULL, BYVAL %NULL, 0, 0, 0, 0, %DDF_UPDATE)
END FUNCTION
'/*
'** DrawDibEnd()
'*/
DECLARE FUNCTION DrawDibEnd LIB "msvfw32.dll" ALIAS "DrawDibEnd"( BYVAL hdd AS QUAD ) AS LONG
'/*
'** DrawDibTime() [for debugging purposes only]
'*/
' // Size = 28 bytes
TYPE DRAWDIBTIME_STRUCT DWORD
 timeCount AS LONG
 timeDraw AS LONG
 timeDecompress AS LONG
 timeDither AS LONG
 timeStretch AS LONG
 timeBlt AS LONG
 timeSetDIBits AS LONG
END TYPE
MACRO tagDRAWDIBTIME = DRAWDIBTIME_STRUCT
DECLARE FUNCTION DrawDibTime LIB "msvfw32.dll" ALIAS "DrawDibTime"( BYVAL hdd AS QUAD , BYREF lpddtime AS DRAWDIBTIME_STRUCT ) AS LONG
'/* display profiling */
%EQUATE `PD_CAN_DRAW_DIB = &H0001 ' /* if you can draw at all */
%EQUATE `PD_CAN_STRETCHDIB = &H0002 ' /* basicly RC_STRETCHDIB */
%EQUATE `PD_STRETCHDIB_1_1_OK = &H0004 ' /* is it fast? */
%EQUATE `PD_STRETCHDIB_1_2_OK = &H0008 ' /* ... */
%EQUATE `PD_STRETCHDIB_1_N_OK = &H0010 ' /* ... */
DECLARE FUNCTION DrawDibProfileDisplay LIB "msvfw32.dll" ALIAS "DrawDibProfileDisplay"( BYREF lpbi AS BITMAPINFOHEADER ) AS LONG
#IF %DEF(%DRAWDIB_INCLUDE_STRETCHDIB)
DECLARE FUNCTION StretchDIB LIB "msvfw32.dll" ALIAS "StretchDIB" ( BYREF biDst AS BITMAPINFOHEADER , BYVAL lpDst AS QUAD , BYVAL DstX AS LONG , BYVAL DstY AS LONG , BYVAL DstXE AS LONG , BYVAL DstYE AS LONG , BYREF biSrc AS BITMAPINFOHEADER , BYVAL lpSrc AS QUAD , BYVAL SrcX AS LONG , BYVAL SrcY AS LONG , BYVAL SrcXE AS LONG , BYVAL SrcYE AS LONG ) AS LONG
#ENDIF
#ENDIF ' /* NODRAWDIB */ --------------------------------------------------------------
'/****************************************************************************
' *
' * AVIFMT - AVI file format definitions
' *
' ****************************************************************************/
#IF NOT %DEF(%NOAVIFMT) ' ----------------------------------------------------------------
'#ifndef NOAVIFMT
' #ifndef _INC_MMSYSTEM
' typedef DWORD FOURCC;
' #endif
'#ifdef _MSC_VER
'#pragma warning(disable:4200)
'#endif
'/* The following is a short description of the AVI file format. Please
' * see the accompanying documentation for a full explanation.
' *
' * An AVI file is the following RIFF form:
' *
' * RIFF('AVI'
' * LIST('hdrl'
' * avih(<MainAVIHeader>)
' * LIST ('strl'
' * strh(<Stream header>)
' * strf(<Stream format>)
' * ... additional header data
' * LIST('movi'
' * { LIST('rec'
' * SubChunk...
' * )
' * | SubChunk } ....
' * )
' * [ <AVIIndex> ]
' * )
' *
' * The main file header specifies how many streams are present. For
' * each one, there must be a stream header chunk and a stream format
' * chunk, enlosed in a 'strl' LIST chunk. The 'strf' chunk contains
' * type-specific format information; for a video stream, this should
' * be a BITMAPINFO structure, including palette. For an audio stream,
' * this should be a WAVEFORMAT (or PCMWAVEFORMAT) structure.
' *
' * The actual data is contained in subchunks within the 'movi' LIST
' * chunk. The first two characters of each data chunk are the
' * stream number with which that data is associated.
' *
' * Some defined chunk types:
' * Video Streams:
' * ##db: RGB DIB bits
' * ##dc: RLE8 compressed DIB bits
' * ##pc: Palette Change
' *
' * Audio Streams:
' * ##wb: waveform audio bytes
' *
' * The grouping into LIST 'rec' chunks implies only that the contents of
' * the chunk should be read into memory at the same time. This
' * grouping is used for files specifically intended to be played from
' * CD-ROM.
' *
' * The index chunk at the end of the file should contain one entry for
' * each data chunk in the file.
' *
' * Limitations for the current software:
' * Only one video stream and one audio stream are allowed.
' * The streams must start at the beginning of the file.
' *
' *
' * To register codec types please obtain a copy of the Multimedia
' * Developer Registration Kit from:
' *
' * Microsoft Corporation
' * Multimedia Systems Group
' * Product Marketing
' * One Microsoft Way
' * Redmond, WA 98052-6399
' *
' */
'#ifndef mmioFOURCC
'#define mmioFOURCC( ch0, ch1, ch2, ch3 ) \
' ( (DWORD)(BYTE)(ch0) | ( (DWORD)(BYTE)(ch1) << 8 ) | \
' ( (DWORD)(BYTE)(ch2) << 16 ) | ( (DWORD)(BYTE)(ch3) << 24 ) )
'#endif
#IF NOT %DEF(%MMIOFOURCC_DEFINED)
%EQUATE `MMIOFOURCC_DEFINED = 1
FUNCTION mmioFOURCC (BYVAL st0 AS STRING, BYVAL st1 AS STRING, BYVAL st2 AS STRING, BYVAL st3 AS STRING) AS DWORD
 LOCAL ch0 AS DWORD, ch1 AS DWORD, ch2 AS DWORD, ch3 AS DWORD
 ch0 = ASC(st0)
 ch1 = ASC(st1)
 ch2 = ASC(st2)
 ch3 = ASC(st3)
 SHIFT LEFT ch1, 8
 SHIFT LEFT ch2, 16
 SHIFT LEFT ch3, 24
 FUNCTION = ch0 OR ch1 OR ch2 OR ch3
END FUNCTION
#ENDIF
'/* Macro to make a TWOCC out of two characters */
'#ifndef aviTWOCC
'#define aviTWOCC(ch0, ch1) ((WORD)(BYTE)(ch0) | ((WORD)(BYTE)(ch1) << 8))
'#endif
#IF NOT %DEF(%AVITWOCC_DEFINED)
%EQUATE `AVITWOCC_DEFINED = 1
FUNCTION aviTWOCC (BYVAL st0 AS STRING, BYVAL st1 AS STRING) AS WORD
 LOCAL ch0 AS WORD, ch1 AS WORD
 ch0 = ASC(st0)
 ch1 = ASC(st1)
 SHIFT LEFT ch1, 8
 FUNCTION = ch0 OR ch1
END FUNCTION
#ENDIF
'typedef WORD TWOCC;
'/* form types, list types, and chunk types */
'#define formtypeAVI mmioFOURCC('A', 'V', 'I', ' ')
'#define listtypeAVIHEADER mmioFOURCC('h', 'd', 'r', 'l')
'#define ckidAVIMAINHDR mmioFOURCC('a', 'v', 'i', 'h')
'#define listtypeSTREAMHEADER mmioFOURCC('s', 't', 'r', 'l')
'#define ckidSTREAMHEADER mmioFOURCC('s', 't', 'r', 'h')
'#define ckidSTREAMFORMAT mmioFOURCC('s', 't', 'r', 'f')
'#define ckidSTREAMHANDLERDATA mmioFOURCC('s', 't', 'r', 'd')
'#define ckidSTREAMNAME mmioFOURCC('s', 't', 'r', 'n')
'#define listtypeAVIMOVIE mmioFOURCC('m', 'o', 'v', 'i')
'#define listtypeAVIRECORD mmioFOURCC('r', 'e', 'c', ' ')
'#define ckidAVINEWINDEX mmioFOURCC('i', 'd', 'x', '1')
%EQUATE `formtypeAVI = &H20495641 ' // mmioFOURCC('A', 'V', 'I', ' ')
%EQUATE `listtypeAVIHEADER = &H6C726468 ' // mmioFOURCC('h', 'd', 'r', 'l')
%EQUATE `ckidAVIMAINHDR = &H68697661 ' // mmioFOURCC('a', 'v', 'i', 'h')
%EQUATE `listtypeSTREAMHEADER = &H6C727473 ' // mmioFOURCC('s', 't', 'r', 'l')
%EQUATE `ckidSTREAMHEADER = &H68727473 ' // mmioFOURCC('s', 't', 'r', 'h')
%EQUATE `ckidSTREAMFORMAT = &H66727473 ' // mmioFOURCC('s', 't', 'r', 'f')
%EQUATE `ckidSTREAMHANDLERDATA = &H64727473 ' // mmioFOURCC('s', 't', 'r', 'd')
%EQUATE `ckidSTREAMNAME = &H6E727473 ' // mmioFOURCC('s', 't', 'r', 'n')
%EQUATE `listtypeAVIMOVIE = &H69766F6D ' // mmioFOURCC('m', 'o', 'v', 'i')
%EQUATE `listtypeAVIRECORD = &H20636572 ' // mmioFOURCC('r', 'e', 'c', ' ')
%EQUATE `ckidAVINEWINDEX = &H31786469 ' // mmioFOURCC('i', 'd', 'x', '1')
'/*
'** Stream types for the <fccType> field of the stream header.
'*/
'#define streamtypeVIDEO mmioFOURCC('v', 'i', 'd', 's')
'#define streamtypeAUDIO mmioFOURCC('a', 'u', 'd', 's')
'#define streamtypeMIDI mmioFOURCC('m', 'i', 'd', 's')
'#define streamtypeTEXT mmioFOURCC('t', 'x', 't', 's')
%EQUATE `streamtypeVIDEO = &H73646976 ' mmioFOURCC('v', 'i', 'd', 's')
%EQUATE `streamtypeAUDIO = &H73647561 ' mmioFOURCC('a', 'u', 'd', 's')
%EQUATE `streamtypeMIDI = &H7364696D ' mmioFOURCC('m', 'i', 'd', 's')
%EQUATE `streamtypeTEXT = &H73747874 ' mmioFOURCC('t', 'x', 't', 's')
'/* Basic chunk types */
'#define cktypeDIBbits aviTWOCC('d', 'b')
'#define cktypeDIBcompressed aviTWOCC('d', 'c')
'#define cktypePALchange aviTWOCC('p', 'c')
'#define cktypeWAVEbytes aviTWOCC('w', 'b')
%EQUATE `cktypeDIBbits = &H6264 ' // aviTWOCC('d', 'b')
%EQUATE `cktypeDIBcompressed = &H6364 ' // aviTWOCC('d', 'c')
%EQUATE `cktypePALchange = &H6370 ' // aviTWOCC('p', 'c')
%EQUATE `cktypeWAVEbytes = &H6277 ' // aviTWOCC('w', 'b')
'/* Chunk id to use for extra chunks for padding. */
'#define ckidAVIPADDING mmioFOURCC('J', 'U', 'N', 'K')
%EQUATE `ckidAVIPADDING = &H4B4E554A ' // mmioFOURCC('J', 'U', 'N', 'K')
'/*
'** Useful macros
'**
'** Warning: These are nasty macro, and MS C 6.0 compiles some of them
'** incorrectly if optimizations are on. Ack.
'*/
''/* Macro to get stream number out of a FOURCC ckid */
'#define FromHex(n) (((n) >= 'A') ? ((n) + 10 - 'A') : ((n) - '0'))
'#define StreamFromFOURCC(fcc) ((WORD) ((FromHex(LOBYTE(LOWORD(fcc))) << 4) + \
' (FromHex(HIBYTE(LOWORD(fcc))))))
FUNCTION FromHex (BYVAL n AS BYTE) AS BYTE
 IF n >= ASC("A") THEN
 FUNCTION = n + 10 - ASC("A")
 ELSE
 FUNCTION = n - ASC("0")
 END IF
END FUNCTION
FUNCTION StreamFromFOURCC (BYVAL fcc AS DWORD) AS WORD
 LOCAL w AS WORD
 LOCAL b1 AS BYTE
 LOCAL b2 AS BYTE
 w = LO(WORD, fcc)
 b1 = LO(BYTE, w)
 SHIFT LEFT b1, 4
 b1 = FromHex(b1)
 b2 = HI(BYTE, w)
 b2 = FromHex(b2)
 FUNCTION = b1 + b2
END FUNCTION
'/* Macro to get TWOCC chunk type out of a FOURCC ckid */
'#define TWOCCFromFOURCC(fcc) HIWORD(fcc)
FUNCTION TWOCCFromFOURCC (BYVAL fcc AS DWORD) AS WORD
 FUNCTION = HI(WORD, fcc)
END FUNCTION
'/* Macro to make a ckid for a chunk out of a TWOCC and a stream number
'** from 0-255.
'*/
'#define ToHex(n) ((BYTE) (((n) > 9) ? ((n) - 10 + 'A') : ((n) + '0')))
'#define MAKEAVICKID(tcc, stream) \
' MAKELONG((ToHex((stream) & 0x0f) << 8) | \
' (ToHex(((stream) & 0xf0) >> 4)), tcc)
FUNCTION ToHex (BYVAL n AS BYTE) AS BYTE
 IF n > 9 THEN
 FUNCTION = n - 10 + ASC("A")
 ELSE
 FUNCTION = n + ASC("0")
 END IF
END FUNCTION
FUNCTION MAKEAVICKID (BYVAL tcc AS WORD, BYVAL stream AS BYTE) AS DWORD
 LOCAL b1 AS BYTE
 LOCAL b2 AS BYTE
 b1 = stream AND &H0F
 SHIFT LEFT b1, 8
 b1 = ToHex(b1)
 b2 = stream AND &HF0
 SHIFT RIGHT b2, 4
 b2 = ToHex(b2)
 FUNCTION = MAK(DWORD, b1 OR b2, tcc)
END FUNCTION
'/*
'** Main AVI File Header
'*/
'/* flags for use in <dwFlags> in AVIFileHdr */
%EQUATE `AVIF_HASINDEX = &H00000010 ' // Index at end of file?
%EQUATE `AVIF_MUSTUSEINDEX = &H00000020
%EQUATE `AVIF_ISINTERLEAVED = &H00000100
%EQUATE `AVIF_WASCAPTUREFILE = &H00010000
%EQUATE `AVIF_COPYRIGHTED = &H00020000
'/* The AVI File Header LIST chunk should be padded to this size */
%EQUATE `AVI_HEADERSIZE = 2048 ' // size of AVI header list
' // Size = 56 bytes
TYPE MainAVIHeader DWORD
 dwMicroSecPerFrame AS DWORD ' DWORD // frame display rate (or 0L)
 dwMaxBytesPerSec AS DWORD ' DWORD // max. transfer rate
 dwPaddingGranularity AS DWORD ' DWORD // pad to multiples of this size; normally 2K.
 dwFlags AS DWORD ' DWORD // the ever-present flags
 dwTotalFrames AS DWORD ' DWORD // # frames in file
 dwInitialFrames AS DWORD
 dwStreams AS DWORD
 dwSuggestedBufferSize AS DWORD
 dwWidth AS DWORD
 dwHeight AS DWORD
 dwReserved(3) AS DWORD ' DWORD[4]
END TYPE
'/*
'** Stream header
'*/
%EQUATE `AVISF_DISABLED = &H00000001
%EQUATE `AVISF_VIDEO_PALCHANGES = &H00010000
' // Size = 64 bytes
TYPE AVIStreamHeader DWORD FILL
 fccType AS DWORD ' FOURCC
 fccHandler AS DWORD ' FOURCC
 dwFlags AS DWORD ' DWORD /* Contains AVITF_* flags */
 wPriority AS WORD ' WORD
 wLanguage AS WORD ' WORD
 dwInitialFrames AS DWORD
 dwScale AS DWORD
 dwRate AS DWORD ' DWORD /* dwRate / dwScale == samples/second */
 dwStart AS DWORD
 dwLength AS DWORD ' DWORD /* In units above... */
 dwSuggestedBufferSize AS DWORD
 dwQuality AS DWORD
 dwSampleSize AS DWORD
 rcFrame AS RECT ' RECT
END TYPE
'/* Flags for index */
%EQUATE `AVIIF_LIST = &H00000001 ' // chunk is a 'LIST'
%EQUATE `AVIIF_KEYFRAME = &H00000010 ' // this frame is a key frame.
%EQUATE `AVIIF_FIRSTPART = &H00000020 ' // this frame is the start of a partial frame.
%EQUATE `AVIIF_LASTPART = &H00000040 ' // this frame is the end of a partial frame.
%EQUATE `AVIIF_MIDPART = %AVIIF_LASTPART OR %AVIIF_FIRSTPART
%EQUATE `AVIIF_NOTIME = &H00000100 ' // this frame doesn't take any time
%EQUATE `AVIIF_COMPUSE = &H0FFF0000 ' // these bits are for compressor use
' // Size = 16 bytes
TYPE AVIINDEXENTRY DWORD
 ckid AS DWORD
 dwFlags AS DWORD
 dwChunkOffset AS DWORD ' DWORD // Position of chunk
 dwChunkLength AS DWORD ' DWORD // Length of chunk
END TYPE
'/*
'** Palette change chunk
'**
'** Used in video streams.
'*/
' // Size = 4 bytes
TYPE AVIPALCHANGE BYTE
 bFirstEntry AS BYTE ' /* first entry to change */
 bNumEntries AS BYTE ' /* # entries to change (0 if 256) */
 wFlags AS WORD ' /* Mostly to preserve alignment... */
 'peNew() AS PALETTEENTRY ' /* New color specifications */
END TYPE
#ENDIF ' /* NOAVIFMT */ ---------------------------------------------------------------
'/****************************************************************************
' *
' * MMREG.H (standard include file for MM defines, like FOURCC and things)
' *
' ***************************************************************************/
'#ifndef RC_INVOKED
'#include "pshpack8.h"
'#endif
'#ifndef NOMMREG
' #include <mmreg.h>
'#endif
#IF NOT %DEF(%NOMMREG) ' ----------------------------------------------------------------
 #INCLUDE ONCE "Legacy/System/MMReg.inc"
#ENDIF
'/****************************************************************************
' *
' * AVIFile - routines for reading/writing standard AVI files
' *
' ***************************************************************************/
#IF NOT %DEF(%NOAVIFILE) ' ---------------------------------------------------------------
'/*
' * Ansi - Unicode thunking.
' *
' * Unicode or Ansi-only apps can call the avifile APIs.
' * any Win32 app who wants to use
' * any of the AVI COM interfaces must be UNICODE - the AVISTREAMINFO and
' * AVIFILEINFO structures used in the Info methods of these interfaces are
' * the unicode variants, and no thunking to or from ansi takes place
' * except in the AVIFILE api entrypoints.
' *
' * For Ansi/Unicode thunking: for each entrypoint or structure that
' * uses chars or strings, two versions are declared in the Win32 version,
' * ApiNameW and ApiNameA. The default name ApiName is #defined to one or
' * other of these depending on whether UNICODE is defined (during
' * compilation of the app that is including this header). The source will
' * contain ApiName and ApiNameA (with ApiName being the Win16 implementation,
' * and also #defined to ApiNameW, and ApiNameA being the thunk entrypoint).
' *
' */
'#ifndef mmioFOURCC
' #define mmioFOURCC( ch0, ch1, ch2, ch3 ) \
' ( (DWORD)(BYTE)(ch0) | ( (DWORD)(BYTE)(ch1) << 8 ) | \
' ( (DWORD)(BYTE)(ch2) << 16 ) | ( (DWORD)(BYTE)(ch3) << 24 ) )
'#endif
#IF NOT %DEF(%MMIOFOURCC_DEFINED)
%EQUATE `MMIOFOURCC_DEFINED = 1
FUNCTION mmioFOURCC (BYVAL st0 AS STRING, BYVAL st1 AS STRING, BYVAL st2 AS STRING, BYVAL st3 AS STRING) AS DWORD
 LOCAL ch0 AS DWORD, ch1 AS DWORD, ch2 AS DWORD, ch3 AS DWORD
 ch0 = ASC(st0)
 ch1 = ASC(st1)
 ch2 = ASC(st2)
 ch3 = ASC(st3)
 SHIFT LEFT ch1, 8
 SHIFT LEFT ch2, 16
 SHIFT LEFT ch3, 24
 FUNCTION = ch0 OR ch1 OR ch2 OR ch3
END FUNCTION
#ENDIF
'#ifndef streamtypeVIDEO
'#define streamtypeVIDEO mmioFOURCC('v', 'i', 'd', 's')
'#define streamtypeAUDIO mmioFOURCC('a', 'u', 'd', 's')
'#define streamtypeMIDI mmioFOURCC('m', 'i', 'd', 's')
'#define streamtypeTEXT mmioFOURCC('t', 'x', 't', 's')
'#endif
#IF NOT %DEF(%streamtypeVIDEO)
%EQUATE `streamtypeVIDEO = &H73646976 ' mmioFOURCC('v', 'i', 'd', 's')
%EQUATE `streamtypeAUDIO = &H73647561 ' mmioFOURCC('a', 'u', 'd', 's')
%EQUATE `streamtypeMIDI = &H7364696D ' mmioFOURCC('m', 'i', 'd', 's')
%EQUATE `streamtypeTEXT = &H73747874 ' mmioFOURCC('t', 'x', 't', 's')
#ENDIF
#IF NOT %DEF(%AVIIF_KEYFRAME)
%EQUATE `AVIIF_KEYFRAME = &H00000010& ' // this frame is a key frame.
#ENDIF
'// For GetFrame::SetFormat - use the best format for the display
%EQUATE `AVIGETFRAMEF_BESTDISPLAYFMT = 1
'//
'// Structures used by AVIStreamInfo & AVIFileInfo.
'//
'// These are related to, but not identical to, the header chunks
'// in an AVI file.
'//
'/*
' *
' * --- AVISTREAMINFO ------------------------------------------------
' *
' * for Unicode/Ansi thunking we need to declare three versions of this!
' */
' // Size = 204 bytes
TYPE AVISTREAMINFOW_STRUCT DWORD FILL
 fccType AS DWORD
 fccHandler AS DWORD
 dwFlags AS DWORD ' DWORD /* Contains AVITF_* flags */
 dwCaps AS DWORD
 wPriority AS WORD ' WORD
 wLanguage AS WORD ' WORD
 dwScale AS DWORD
 dwRate AS DWORD ' DWORD /* dwRate / dwScale == samples/second */
 dwStart AS DWORD
 dwLength AS DWORD ' DWORD/* In units above... */
 dwInitialFrames AS DWORD
 dwSuggestedBufferSize AS DWORD
 dwQuality AS DWORD
 dwSampleSize AS DWORD
 rcFrame AS RECT ' RECT
 dwEditCount AS DWORD
 dwFormatChangeCount AS DWORD
 szName AS WSTRINGZ * 64 ' WCHAR
END TYPE
' // Size = 140 bytes
TYPE AVISTREAMINFOA_STRUCT DWORD FILL
 fccType AS DWORD
 fccHandler AS DWORD
 dwFlags AS DWORD ' DWORD /* Contains AVITF_* flags */
 dwCaps AS DWORD
 wPriority AS WORD ' WORD
 wLanguage AS WORD ' WORD
 dwScale AS DWORD
 dwRate AS DWORD ' DWORD /* dwRate / dwScale == samples/second */
 dwStart AS DWORD
 dwLength AS DWORD ' DWORD/* In units above... */
 dwInitialFrames AS DWORD
 dwSuggestedBufferSize AS DWORD
 dwQuality AS DWORD
 dwSampleSize AS DWORD
 rcFrame AS RECT ' RECT
 dwEditCount AS DWORD
 dwFormatChangeCount AS DWORD
 szName AS ASCIIZ * 64 ' char
END TYPE
MACRO tagAVISTREAMINFOW = AVISTREAMINFOW_STRUCT
MACRO tagAVISTREAMINFOA = AVISTREAMINFOA_STRUCT
MACRO AVISTREAMINFO_STRUCT = AVISTREAMINFOA_STRUCT
MACRO tagAVISTREAMINFO = AVISTREAMINFOA_STRUCT
%EQUATE `AVISTREAMINFO_DISABLED = &H00000001
%EQUATE `AVISTREAMINFO_FORMATCHANGES = &H00010000
'/*
' * --- AVIFILEINFO ----------------------------------------------------
' *
' */
' // Size = 108 bytes
TYPE AVIFILEINFOA_STRUCT DWORD
 dwMaxBytesPerSec AS DWORD ' DWORD // max. transfer rate
 dwFlags AS DWORD ' DWORD // the ever-present flags
 dwCaps AS DWORD
 dwStreams AS DWORD
 dwSuggestedBufferSize AS DWORD
 dwWidth AS DWORD
 dwHeight AS DWORD
 dwScale AS DWORD
 dwRate AS DWORD ' DWORD /* dwRate / dwScale == samples/second */
 dwLength AS DWORD
 dwEditCount AS DWORD
 szFileType AS ASCIIZ * 64 ' char // descriptive string for file type?
END TYPE
' // Size = 172 bytes
TYPE AVIFILEINFOW_STRUCT DWORD
 dwMaxBytesPerSec AS DWORD ' DWORD // max. transfer rate
 dwFlags AS DWORD ' DWORD // the ever-present flags
 dwCaps AS DWORD
 dwStreams AS DWORD
 dwSuggestedBufferSize AS DWORD
 dwWidth AS DWORD
 dwHeight AS DWORD
 dwScale AS DWORD
 dwRate AS DWORD ' DWORD /* dwRate / dwScale == samples/second */
 dwLength AS DWORD
 dwEditCount AS DWORD
 szFileType AS WSTRINGZ * 64 ' WCHAR // descriptive string for file type?
END TYPE
MACRO tagAVIFILEINFOA = AVIFILEINFOA_STRUCT
MACRO tagAVIFILEINFOW = AVIFILEINFOW_STRUCT
MACRO AVIFILEINFO_STRUCT = AVIFILEINFOA_STRUCT
MACRO tagAVIFILEINFO = AVIFILEINFOA_STRUCT
'// Flags for dwFlags
%EQUATE `AVIFILEINFO_HASINDEX = &H00000010
%EQUATE `AVIFILEINFO_MUSTUSEINDEX = &H00000020
%EQUATE `AVIFILEINFO_ISINTERLEAVED = &H00000100
%EQUATE `AVIFILEINFO_WASCAPTUREFILE = &H00010000
%EQUATE `AVIFILEINFO_COPYRIGHTED = &H00020000
'// Flags for dwCaps
%EQUATE `AVIFILECAPS_CANREAD = &H00000001
%EQUATE `AVIFILECAPS_CANWRITE = &H00000002
%EQUATE `AVIFILECAPS_ALLKEYFRAMES = &H00000010
%EQUATE `AVIFILECAPS_NOCOMPRESSION = &H00000020
'typedef BOOL (FAR PASCAL * AVISAVECALLBACK)(int);
'FUNCTION AVISAVECALLBACK (BYVAL LONG) AS LONG
'/************************************************************************/
'/* Declaration for the AVICOMPRESSOPTIONS structure. Make sure it */
'/* matches the AutoDoc in avisave.c !!! */
'/************************************************************************/
' // Size = 44 bytes
TYPE AVICOMPRESSOPTIONS_STRUCT DWORD
 fccType AS DWORD ' DWORD /* stream type, for consistency */
 fccHandler AS DWORD ' DWORD /* compressor */
 dwKeyFrameEvery AS DWORD ' DWORD /* keyframe rate */
 dwQuality AS DWORD ' DWORD /* compress quality 0-10,000 */
 dwBytesPerSecond AS DWORD ' DWORD /* bytes per second */
 dwFlags AS DWORD ' DWORD /* flags... see below */
 lpFormat AS DWORD ' LPVOID /* save format */
 cbFormat AS DWORD
 lpParms AS DWORD ' LPVOID /* compressor options */
 cbParms AS DWORD
 dwInterleaveEvery AS DWORD ' DWORD /* for non-video streams only */
END TYPE
MACRO tagAVICOMPRESSOPTIONS = AVICOMPRESSOPTIONS_STRUCT
'//
'// Defines for the dwFlags field of the AVICOMPRESSOPTIONS struct
'// Each of these flags determines if the appropriate field in the structure
'// (dwInterleaveEvery, dwBytesPerSecond, and dwKeyFrameEvery) is payed
'// attention to. See the autodoc in avisave.c for details.
'//
%EQUATE `AVICOMPRESSF_INTERLEAVE = &H00000001 ' // interleave
%EQUATE `AVICOMPRESSF_DATARATE = &H00000002 ' // use a data rate
%EQUATE `AVICOMPRESSF_KEYFRAMES = &H00000004 ' // use keyframes
%EQUATE `AVICOMPRESSF_VALID = &H00000008 ' // has valid data?
#INCLUDE ONCE "Legacy/COM/Ole2.inc"
'/* - - - - - - - - */
'/****** GUIDs *******************************************/
'#define DEFINE_AVIGUID(name, l, w1, w2) \
' DEFINE_GUID(name, l, w1, w2, 0xC0,0,0,0,0,0,0,0x46)
$IID_IAVIFile = GUID$("{00020020-0000-0000-C000-000000000046}")
$IID_IAVIStream = GUID$("{00020021-0000-0000-C000-000000000046}")
$IID_IAVIStreaming = GUID$("{00020022-0000-0000-C000-000000000046}")
$IID_IGetFrame = GUID$("{00020023-0000-0000-C000-000000000046}")
$IID_IAVIEditStream = GUID$("{00020024-0000-0000-C000-000000000046}")
$IID_IAVIPersistFile = GUID$("{00020025-0000-0000-C000-000000000046}")
$CLSID_AVISimpleUnMarshal = GUID$("{00020009-0000-0000-C000-000000000046}")
$CLSID_AVIFile = GUID$("{00020000-0000-0000-C000-000000000046}")
' ########################################################################################
' IAVIStream interface
' IID = 00020021-0000-0000-C000-000000000046
' Inherited interface = IUnknown
' ########################################################################################
INTERFACE IAVIStream $IID_IAVIStream
 INHERIT IUnknown
 ' =====================================================================================
 METHOD Create ( ' VTable offset = 12
 BYVAL lParam1 AS LONG
 , BYVAL lParam2 AS LONG
 ) AS LONG
 ' =====================================================================================
 METHOD Info ( ' VTable offset = 16
 BYREF psi AS AVISTREAMINFOW_STRUCT
 , BYVAL lSize AS LONG
 ) AS LONG
 ' =====================================================================================
 METHOD FindSample ( ' VTable offset = 20
 BYVAL lPos AS LONG
 , BYVAL lFlags AS LONG
 ) AS LONG
 ' =====================================================================================
 METHOD ReadFormat ( ' VTable offset = 24
 BYVAL lPos AS LONG
 , BYVAL lpFormat AS DWORD
 , BYREF lpcbFormat AS LONG
 ) AS LONG
 ' =====================================================================================
 METHOD SetFormat ( ' VTable offset = 28
 BYVAL lPos AS LONG
 , BYVAL lpFormat AS DWORD
 , BYVAL cbFormat AS LONG
 ) AS LONG
 ' =====================================================================================
 METHOD Read ( ' VTable offset = 32
 BYVAL lStart AS LONG
 , BYVAL lSamples AS LONG
 , BYVAL lpBuffer AS DWORD
 , BYVAL cbBuffer AS LONG
 , BYREF plBytes AS LONG
 , BYREF plSamples AS LONG
 ) AS LONG
 ' =====================================================================================
 METHOD Write ( ' VTable offset = 36
 BYVAL lStart AS LONG
 , BYVAL lSamples As LONG
 , BYVAL lpFormat AS DWORD
 , BYVAL cbBuffer AS LONG
 , BYVAL dwFlags AS DWORD
 , BYREF plSampWritten AS LONG
 , BYREF plBytesWritten AS LONG
 ) AS LONG
 ' =====================================================================================
 METHOD Delete ( ' VTable offset = 40
 BYVAL lStart AS LONG
 , BYVAL lSamples AS LONG
 ) AS LONG
 ' =====================================================================================
 METHOD ReadData ( ' VTable offset = 44
 BYVAL fcc AS DWORD
 , BYVAL lpBuffer AS DWORD
 , BYREF lpcbBuffer AS LONG
 ) AS LONG
 ' =====================================================================================
 METHOD WriteData ( ' VTable offset = 48
 BYVAL fcc AS DWORD
 , BYVAL lpBuffer AS DWORD
 , BYVAL cbBuffer AS LONG
 ) AS LONG
 ' =====================================================================================
 METHOD SetInfo ( ' VTable offset = 52
 BYREF lpInfo AS AVISTREAMINFOW_STRUCT
 , BYVAL cbInfo AS LONG
 ) AS LONG
 ' =====================================================================================
END INTERFACE
' ########################################################################################
' IAVIStreaming interface
' IID = 00020022-0000-0000-C000-000000000046
' Inherited interface = IUnknown
' ########################################################################################
INTERFACE IAVIStreaming $IID_IAVIStreaming
 INHERIT IUnknown
 ' =====================================================================================
 METHOD Begin ( ' VTable offset = 12
 BYVAL lStart AS LONG
 , BYVAL lEnd AS LONG
 , BYVAL lRate AS LONG
 ) AS LONG
 ' =====================================================================================
 METHOD End ( ' VTable offset = 16
 ) AS LONG
 ' =====================================================================================
END INTERFACE
' ########################################################################################
' IAVIEditStream interface
' IID = 00020024-0000-0000-C000-000000000046
' Inherited interface = IUnknown
' ########################################################################################
INTERFACE IAVIEditStream $IID_IAVIEditStream
 INHERIT IUnknown
 ' =====================================================================================
 METHOD Cut ( ' VTable offset = 12
 BYREF LONG
 , BYREF LONG
 , BYREF IAVIStream
 ) AS LONG
 ' =====================================================================================
 METHOD Copy ( ' VTable offset = 16
 BYREF LONG
 , BYREF LONG
 , BYREF IAVIStream
 ) AS LONG
 ' =====================================================================================
 METHOD Paste ( ' VTable offset = 20
 BYREF LONG
 , BYREF LONG
 , BYVAL IAVIStream
 , BYVAL LONG
 , BYVAL LONG
 ) AS LONG
 ' =====================================================================================
 METHOD Clone ( ' VTable offset = 24
 BYREF IAVIStream
 ) AS LONG
 ' =====================================================================================
 METHOD SetInfo ( ' VTable offset = 28
 BYREF AVISTREAMINFOW_STRUCT
 , BYVAL LONG
 ) AS LONG
 ' =====================================================================================
END INTERFACE
' ########################################################################################
' IAVIPersistFile interface
' IID = 00020025-0000-0000-C000-000000000046
' Inherited interface = IPersistFile
' ########################################################################################
INTERFACE IAVIPersistFile $IID_IAVIPersistFile
 INHERIT IUnknown
 ' =====================================================================================
 ' IPersistFile Methods
 ' =====================================================================================
 METHOD GetClassID ( ' VTable offset = 12
 BYREF pClassID AS GUID
 ) AS LONG
 ' =====================================================================================
 METHOD IsDirty ( ' VTable offset = 16
 ) AS LONG
 ' =====================================================================================
 METHOD Load ( ' VTable offset = 20
 BYREF pszFileName AS WSTRINGZ
 , BYVAL dwMode AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD Save ( ' VTable offset = 24
 BYREF pszFileName AS WSTRINGZ
 , BYVAL fRemember AS LONG
 ) AS LONG
 ' =====================================================================================
 METHOD SaveCompleted ( ' VTable offset = 28
 BYREF pszFileName AS WSTRINGZ
 ) AS LONG
 ' =====================================================================================
 METHOD GetCurFile ( ' VTable offset = 32
 BYREF ppszFileName AS DWORD
 ) AS LONG
 ' =====================================================================================
END INTERFACE
' ########################################################################################
' IAVIFile interface
' IID = 00020020-0000-0000-C000-000000000046
' Inherited interface = IUnknown
' ########################################################################################
INTERFACE IAVIFile $IID_IAVIFile
 INHERIT IUnknown
 ' =====================================================================================
 METHOD Info ( ' VTable offset = 12
 BYREF pfi AS AVISTREAMINFOW_STRUCT
 , BYVAL lSize AS LONG
 ) AS LONG
 ' =====================================================================================
 METHOD GetStream ( ' VTable offset = 16
 BYREF ppStream AS IAVIStream
 , BYVAL fccType AS DWORD
 , BYVAL lParam AS LONG
 ) AS LONG
 ' =====================================================================================
 METHOD CreateStream ( ' VTable offset = 20
 BYREF ppStream AS IAVIStream
 , BYREF psi AS AVISTREAMINFOW_STRUCT
 ) AS LONG
 ' =====================================================================================
 METHOD WriteData ( ' VTable offset = 24
 BYVAL ckid AS DWORD
 , BYVAL lpData AS DWORD
 , BYVAL cbData AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD ReadData ( ' VTable offset = 28
 BYVAL ckid AS DWORD
 , BYVAL lpData AS DWORD
 , BYREF lpcbData AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD EndRecord ( ' VTable offset = 32
 ) AS LONG
 ' =====================================================================================
 METHOD DeleteStream ( ' VTable offset = 36
 BYVAL fccType AS DWORD
 , BYVAL lParam AS LONG
 ) AS LONG
 ' =====================================================================================
END INTERFACE
' ########################################################################################
' IGetFrame interface
' IID = 00020023-0000-0000-C000-000000000046
' Inherited interface = IUnknown
' ########################################################################################
INTERFACE IGetFrame $IID_IGetFrame
 INHERIT IUnknown
 ' =====================================================================================
 METHOD GetFrame ( ' VTable offset = 12
 BYVAL lPos AS LONG
 ) AS LONG
 ' =====================================================================================
 METHOD Begin ( ' VTable offset = 16
 BYVAL lStart AS LONG
 , BYVAL lEnd AS LONG
 , BYVAL lRate AS LONG
 ) AS LONG
 ' =====================================================================================
 METHOD End ( ' VTable offset = 20
 ) AS LONG
 ' =====================================================================================
 METHOD SetFormat ( ' VTable offset = 24
 BYREF lpbi AS BITMAPINFOHEADER
 , BYVAL lpBits AS DWORD
 , BYVAL x AS LONG
 , BYVAL y AS LONG
 , BYVAL dx AS LONG
 , BYVAL dy AS LONG
 ) AS LONG
 ' =====================================================================================
END INTERFACE
%EQUATE `AVIFILEHANDLER_CANREAD = &H0001
%EQUATE `AVIFILEHANDLER_CANWRITE = &H0002
%EQUATE `AVIFILEHANDLER_CANACCEPTNONRGB = &H0004
'//
'// functions
'//
DECLARE SUB AVIFileInit LIB "avifil32.dll" ALIAS "AVIFileInit" () ' void
DECLARE SUB AVIFileExit LIB "avifil32.dll" ALIAS "AVIFileExit" () ' void
DECLARE FUNCTION AVIFileAddRef LIB "avifil32.dll" ALIAS "AVIFileAddRef" ( BYVAL pfile AS QUAD ) AS QUAD ' ULONG
DECLARE FUNCTION AVIFileRelease LIB "avifil32.dll" ALIAS "AVIFileRelease" ( BYVAL pfile AS QUAD ) AS QUAD ' ULONG
DECLARE FUNCTION AVIFileOpenA LIB "avifil32.dll" ALIAS "AVIFileOpenA" ( BYREF ppfile AS QUAD , BYREF szFile AS ASCIIZ , BYVAL mode AS QUAD , BYREF pclsidHandler AS GUID ) AS LONG
DECLARE FUNCTION AVIFileOpenW LIB "avifil32.dll" ALIAS "AVIFileOpenW" ( BYREF ppfile AS QUAD
 , BYREF szFile AS WSTRINGZ
 , BYVAL mode AS DWORD
 , BYREF pclsidHandler AS GUID
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO AVIFileOpen = AVIFileOpenW
#ELSE
 MACRO AVIFileOpen = AVIFileOpenA
#ENDIF
DECLARE FUNCTION AVIFileInfoA LIB "avifil32.dll" ALIAS "AVIFileInfoA" ( BYVAL pfile AS QUAD , BYREF pfi AS AVIFILEINFOA_STRUCT , BYVAL lSize AS LONG ) AS LONG
DECLARE FUNCTION AVIFileInfoW LIB "avifil32.dll" ALIAS "AVIFileInfoW" ( BYVAL pfile AS QUAD
 , BYREF AVIFILEINFOW_STRUCT
 , BYVAL lSize AS LONG
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO AVIFileInfo = AVIFileInfoW
#ELSE
 MACRO AVIFileInfo = AVIFileInfoA
#ENDIF
DECLARE FUNCTION AVIFileGetStream LIB "avifil32.dll" ALIAS "AVIFileGetStream" ( BYVAL pfile AS QUAD , BYREF ppavi AS QUAD , BYVAL fccType AS QUAD , BYVAL lParam AS LONG ) AS LONG
DECLARE FUNCTION AVIFileCreateStreamA LIB "avifil32.dll" ALIAS "AVIFileCreateStreamA" ( BYVAL pfile AS QUAD
 , BYREF ppavi AS DWORD
 , BYREF psi AS AVISTREAMINFOA_STRUCT
 ) AS LONG
DECLARE FUNCTION AVIFileCreateStreamW LIB "avifil32.dll" ALIAS "AVIFileCreateStreamW" ( BYVAL pfile AS DWORD
 , BYREF ppavi AS DWORD
 , BYREF psi AS AVISTREAMINFOW_STRUCT
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO AVIFileCreateStream = AVIFileCreateStreamW
#ELSE
 MACRO AVIFileCreateStream = AVIFileCreateStreamA
#ENDIF
DECLARE FUNCTION AVIFileWriteData LIB "avifil32.dll" ALIAS "AVIFileWriteData" ( BYVAL pfile AS QUAD , BYVAL ckid AS QUAD , BYVAL lpData AS QUAD , BYVAL cbData AS LONG ) AS LONG
DECLARE FUNCTION AVIFileReadData LIB "avifil32.dll" ALIAS "AVIFileReadData" ( BYVAL pfile AS QUAD
 , BYVAL ckid AS DWORD
 , BYVAL lpData AS DWORD
 , BYREF lpcbData AS LONG
 ) AS LONG
DECLARE FUNCTION AVIFileEndRecord LIB "avifil32.dll" ALIAS "AVIFileEndRecord" ( BYVAL pfile AS DWORD
 ) AS LONG
DECLARE FUNCTION AVIStreamAddRef LIB "avifil32.dll" ALIAS "AVIStreamAddRef" ( BYVAL pavi AS DWORD
 ) AS LONG
DECLARE FUNCTION AVIStreamRelease LIB "avifil32.dll" ALIAS "AVIStreamRelease" ( BYVAL pavi AS DWORD
 ) AS LONG
DECLARE FUNCTION AVIStreamInfoA LIB "avifil32.dll" ALIAS "AVIStreamInfoA" ( BYVAL pavi AS DWORD
 , BYREF psi AS AVISTREAMINFOA_STRUCT
 , BYVAL lSize AS LONG
 ) AS LONG
DECLARE FUNCTION AVIStreamInfoW LIB "avifil32.dll" ALIAS "AVIStreamInfoW" ( BYVAL pavi AS DWORD
 , BYREF psi AS AVISTREAMINFOW_STRUCT
 , BYVAL lSize AS LONG
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO AVIStreamInfo = AVIStreamInfoW
#ELSE
 MACRO AVIStreamInfo = AVIStreamInfoA
#ENDIF
DECLARE FUNCTION AVIStreamFindSample LIB "avifil32.dll" ALIAS "AVIStreamFindSample" ( BYVAL pavi AS QUAD , BYVAL lPos AS LONG , BYVAL lFlags AS LONG ) AS LONG
DECLARE FUNCTION AVIStreamReadFormat LIB "avifil32.dll" ALIAS "AVIStreamReadFormat" ( BYVAL pavi AS QUAD
 , BYVAL lPos AS LONG
 , BYVAL lpFormat AS DWORD
 , BYREF lpcbFormat AS LONG
 ) AS LONG
DECLARE FUNCTION AVIStreamSetFormat LIB "avifil32.dll" ALIAS "AVIStreamSetFormat" ( BYVAL pavi AS DWORD
 , BYVAL lPos AS LONG
 , BYVAL lpFormat AS DWORD
 , BYVAL cbFormat AS LONG
 ) AS LONG
DECLARE FUNCTION AVIStreamReadData LIB "avifil32.dll" ALIAS "AVIStreamReadData" ( BYVAL pavi AS DWORD
 , BYVAL fcc AS DWORD
 , BYVAL lp AS DWORD
 , BYREF lpcb AS LONG
 ) AS LONG
DECLARE FUNCTION AVIStreamWriteData LIB "avifil32.dll" ALIAS "AVIStreamWriteData" ( BYVAL pavi AS DWORD
 , BYVAL fcc AS DWORD
 , BYVAL lp AS DWORD
 , BYVAL cb AS LONG
 ) AS LONG
DECLARE FUNCTION AVIStreamRead LIB "avifil32.dll" ALIAS "AVIStreamRead" ( BYVAL pavi AS DWORD
 , BYVAL lStart AS LONG
 , BYVAL lSamples AS LONG
 , BYVAL lpBuffer AS DWORD
 , BYVAL cbBuffer AS LONG
 , BYREF plBytes AS LONG
 , BYREF plSamples AS LONG
 ) AS LONG
%EQUATE `AVISTREAMREAD_CONVENIENT = -1&
DECLARE FUNCTION AVIStreamWrite LIB "avifil32.dll" ALIAS "AVIStreamWrite" ( BYVAL pavi AS QUAD , BYVAL lStart AS LONG , BYVAL lSamples AS LONG , BYVAL lpBuffer AS QUAD , BYVAL cbBuffer AS LONG , BYVAL dwFlags AS QUAD , BYREF plSampWritten AS LONG , BYREF plBytesWritten AS LONG ) AS LONG
'// Right now, these just use AVIStreamInfo() to get information, then
'// return some of it. Can they be more efficient?
DECLARE FUNCTION AVIStreamStart LIB "avifil32.dll" ALIAS "AVIStreamStart" ( BYVAL pavi AS QUAD ) AS LONG
DECLARE FUNCTION AVIStreamLength LIB "avifil32.dll" ALIAS "AVIStreamLength" ( BYVAL pavi AS QUAD
 ) AS LONG
DECLARE FUNCTION AVIStreamTimeToSample LIB "avifil32.dll" ALIAS "AVIStreamTimeToSample" ( BYVAL pavi AS DWORD
 , BYVAL lTime AS LONG
 ) AS LONG
DECLARE FUNCTION AVIStreamSampleToTime LIB "avifil32.dll" ALIAS "AVIStreamSampleToTime" ( BYVAL pavi AS DWORD
 , BYVAL lSample AS LONG
 ) AS LONG
DECLARE FUNCTION AVIStreamBeginStreaming LIB "avifil32.dll" ALIAS "AVIStreamBeginStreaming" ( BYVAL pavi AS DWORD
 , BYVAL lStart AS LONG
 , BYVAL lEnd AS LONG
 , BYVAL lRate AS LONG
 ) AS LONG
DECLARE FUNCTION AVIStreamEndStreaming LIB "avifil32.dll" ALIAS "AVIStreamEndStreaming" ( BYVAL pavi AS DWORD
 ) AS LONG
'//
'// helper functions for using IGetFrame
'//
DECLARE FUNCTION AVIStreamGetFrameOpen LIB "avifil32.dll" ALIAS "AVIStreamGetFrameOpen" ( BYVAL pavi AS QUAD , BYREF lpbiWanted AS BITMAPINFOHEADER ) AS QUAD
DECLARE FUNCTION AVIStreamGetFrame LIB "avifil32.dll" ALIAS "AVIStreamGetFrame" ( BYVAL pg AS QUAD
 , BYVAL lPos AS LONG
 ) AS DWORD
DECLARE FUNCTION AVIStreamGetFrameClose LIB "avifil32.dll" ALIAS "AVIStreamGetFrameClose" ( BYVAL pg AS DWORD
 ) AS LONG
'// !!! We need some way to place an advise on a stream....
'// STDAPI AVIStreamHasChanged (PAVISTREAM pavi);
'// Shortcut function
DECLARE FUNCTION AVIStreamOpenFromFileA LIB "avifil32.dll" ALIAS "AVIStreamOpenFromFileA" ( BYREF ppavi AS QUAD , BYREF szFile AS ASCIIZ , BYVAL fccType AS QUAD , BYVAL lParam AS LONG , BYVAL mode AS QUAD , BYREF pclsidHandler AS GUID ) AS LONG
DECLARE FUNCTION AVIStreamOpenFromFileW LIB "avifil32.dll" ALIAS "AVIStreamOpenFromFileW" ( BYREF ppavi AS QUAD
 , BYREF szFile AS WSTRINGZ
 , BYVAL fccType AS DWORD
 , BYVAL lParam AS LONG
 , BYVAL mode AS DWORD
 , BYREF pclsidHandler AS GUID
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO AVIStreamOpenFromFile = AVIStreamOpenFromFileW
#ELSE
 MACRO AVIStreamOpenFromFile = AVIStreamOpenFromFileA
#ENDIF
'// Use to create disembodied streams
DECLARE FUNCTION AVIStreamCreate LIB "avifil32.dll" ALIAS "AVIStreamCreate" ( BYREF ppavi AS QUAD , BYVAL lParam1 AS LONG , BYVAL lParam2 AS LONG , BYREF pclsidHandler AS GUID ) AS LONG
'// PHANDLER AVIAPI AVIGetHandler (PAVISTREAM pavi, PAVISTREAMHANDLER psh);
'// PAVISTREAM AVIAPI AVIGetStream (PHANDLER p);
'//
'// flags for AVIStreamFindSample
'//
%EQUATE `FIND_DIR = &H0000000F ' // direction
%EQUATE `FIND_NEXT = &H00000001 ' // go forward
%EQUATE `FIND_PREV = &H00000004 ' // go backward
%EQUATE `FIND_FROM_START = &H00000008 ' // start at the logical beginning
%EQUATE `FIND_TYPE = &H000000F0 ' // type mask
%EQUATE `FIND_KEY = &H00000010 ' // find key frame.
%EQUATE `FIND_ANY = &H00000020 ' // find any (non-empty) sample
%EQUATE `FIND_FORMAT = &H00000040 ' // find format change
%EQUATE `FIND_RET = &H0000F000 ' // return mask
%EQUATE `FIND_POS = &H00000000 ' // return logical position
%EQUATE `FIND_LENGTH = &H00001000 ' // return logical size
%EQUATE `FIND_OFFSET = &H00002000 ' // return physical position
%EQUATE `FIND_SIZE = &H00003000 ' // return physical size
%EQUATE `FIND_INDEX = &H00004000 ' // return physical index position
'//
'// stuff to support backward compat.
'//
'#define AVIStreamFindKeyFrame AVIStreamFindSample
'#define FindKeyFrame FindSample
'#define AVIStreamClose AVIStreamRelease
'#define AVIFileClose AVIFileRelease
'#define AVIStreamInit AVIFileInit
'#define AVIStreamExit AVIFileExit
%EQUATE `SEARCH_NEAREST = %FIND_PREV
%EQUATE `SEARCH_BACKWARD = %FIND_PREV
%EQUATE `SEARCH_FORWARD = %FIND_NEXT
%EQUATE `SEARCH_KEY = %FIND_KEY
%EQUATE `SEARCH_ANY = %FIND_ANY
'//
'// helper macros.
'//
'#define AVIStreamSampleToSample(pavi1, pavi2, l) \
' AVIStreamTimeToSample(pavi1,AVIStreamSampleToTime(pavi2, l))
FUNCTION AVIStreamSampleToSample(BYVAL pavi1 AS DWORD, BYVAL pavi2 AS DWORD, BYVAL l AS LONG) AS LONG
 FUNCTION = AVIStreamTimeToSample(pavi1, AVIStreamSampleToTime(pavi2, l))
END FUNCTION
'#define AVIStreamNextSample(pavi, l) \
' AVIStreamFindSample(pavi,l+1,FIND_NEXT|FIND_ANY)
FUNCTION AVIStreamNextSample(BYVAL pavi1 AS DWORD, BYVAL l AS LONG) AS LONG
 FUNCTION = AVIStreamFindSample(pavi1, l+1, %FIND_NEXT OR %FIND_ANY)
END FUNCTION
'#define AVIStreamPrevSample(pavi, l) \
' AVIStreamFindSample(pavi,l-1,FIND_PREV|FIND_ANY)
FUNCTION AVIStreamPrevSample(BYVAL pavi1 AS DWORD, BYVAL l AS LONG) AS LONG
 FUNCTION = AVIStreamFindSample(pavi1, l-1, %FIND_PREV OR %FIND_ANY)
END FUNCTION
'#define AVIStreamNearestSample(pavi, l) \
' AVIStreamFindSample(pavi,l,FIND_PREV|FIND_ANY)
FUNCTION AVIStreamNearestSample(BYVAL pavi1 AS DWORD, BYVAL l AS LONG) AS LONG
 FUNCTION = AVIStreamFindSample(pavi1, l, %FIND_PREV OR %FIND_ANY)
END FUNCTION
'#define AVIStreamNextKeyFrame(pavi,l) \
' AVIStreamFindSample(pavi,l+1,FIND_NEXT|FIND_KEY)
FUNCTION AVIStreamNextKeyFrame(BYVAL pavi1 AS DWORD, BYVAL l AS LONG) AS LONG
 FUNCTION = AVIStreamFindSample(pavi1, l+1, %FIND_NEXT OR %FIND_KEY)
END FUNCTION
'#define AVIStreamPrevKeyFrame(pavi, l) \
' AVIStreamFindSample(pavi,l-1,FIND_PREV|FIND_KEY)
FUNCTION AVIStreamPrevKeyFrame(BYVAL pavi1 AS DWORD, BYVAL l AS LONG) AS LONG
 FUNCTION = AVIStreamFindSample(pavi1, l-1, %FIND_PREV OR %FIND_KEY)
END FUNCTION
'#define AVIStreamNearestKeyFrame(pavi, l) \
' AVIStreamFindSample(pavi,l,FIND_PREV|FIND_KEY)
FUNCTION AVIStreamNearestKeyFrame(BYVAL pavi1 AS DWORD, BYVAL l AS LONG) AS LONG
 FUNCTION = AVIStreamFindSample(pavi1, l, %FIND_PREV OR %FIND_KEY)
END FUNCTION
'#define AVIStreamIsKeyFrame(pavi, l) \
' (AVIStreamNearestKeyFrame(pavi,l) == l)
FUNCTION AVIStreamIsKeyFrame(BYVAL pavi1 AS DWORD, BYVAL l AS LONG) AS LONG
 FUNCTION = (AVIStreamNearestKeyFrame(pavi1, l) = l)
END FUNCTION
'#define AVIStreamPrevSampleTime(pavi, t) \
' AVIStreamSampleToTime(pavi, AVIStreamPrevSample(pavi,AVIStreamTimeToSample(pavi,t)))
FUNCTION AVIStreamPrevSampleTime(BYVAL pavi AS DWORD, BYVAL t AS LONG) AS LONG
 FUNCTION = AVIStreamSampleToTime(pavi, AVIStreamSampleToTime(pavi, AVIStreamPrevSample(pavi, AVIStreamTimeToSample(pavi, t))))
END FUNCTION
'#define AVIStreamNextSampleTime(pavi, t) \
' AVIStreamSampleToTime(pavi, AVIStreamNextSample(pavi,AVIStreamTimeToSample(pavi,t)))
FUNCTION AVIStreamNextSampleTime(BYVAL pavi AS DWORD, BYVAL t AS LONG) AS LONG
 FUNCTION = AVIStreamSampleToTime(pavi, AVIStreamNextSample(pavi, AVIStreamTimeToSample(pavi, t)))
END FUNCTION
'#define AVIStreamNearestSampleTime(pavi, t) \
' AVIStreamSampleToTime(pavi, AVIStreamNearestSample(pavi,AVIStreamTimeToSample(pavi,t)))
FUNCTION AVIStreamNearestSampleTime(BYVAL pavi AS DWORD, BYVAL t AS LONG) AS LONG
 FUNCTION = AVIStreamSampleToTime(pavi, AVIStreamNearestSample(pavi, AVIStreamTimeToSample(pavi, t)))
END FUNCTION
'#define AVIStreamNextKeyFrameTime(pavi, t) \
' AVIStreamSampleToTime(pavi, AVIStreamNextKeyFrame(pavi,AVIStreamTimeToSample(pavi, t)))
FUNCTION AVIStreamNextKeyFrameTime(BYVAL pavi AS DWORD, BYVAL t AS LONG) AS LONG
 FUNCTION = AVIStreamSampleToTime(pavi, AVIStreamNextKeyFrame(pavi, AVIStreamTimeToSample(pavi, t)))
END FUNCTION
'#define AVIStreamPrevKeyFrameTime(pavi, t) \
' AVIStreamSampleToTime(pavi, AVIStreamPrevKeyFrame(pavi,AVIStreamTimeToSample(pavi, t)))
FUNCTION AVIStreamPrevKeyFrameTime(BYVAL pavi AS DWORD, BYVAL t AS LONG) AS LONG
 FUNCTION = AVIStreamSampleToTime(pavi, AVIStreamPrevKeyFrame(pavi, AVIStreamTimeToSample(pavi, t)))
END FUNCTION
'#define AVIStreamNearestKeyFrameTime(pavi, t) \
' AVIStreamSampleToTime(pavi, AVIStreamNearestKeyFrame(pavi,AVIStreamTimeToSample(pavi, t)))
FUNCTION AVIStreamNearestKeyFrameTime(BYVAL pavi AS DWORD, BYVAL t AS LONG) AS LONG
 FUNCTION = AVIStreamSampleToTime(pavi, AVIStreamNearestKeyFrame(pavi, AVIStreamTimeToSample(pavi, t)))
END FUNCTION
'#define AVIStreamStartTime(pavi) \
' AVIStreamSampleToTime(pavi, AVIStreamStart(pavi))
FUNCTION AVIStreamStartTime(BYVAL pavi AS DWORD) AS LONG
 FUNCTION = AVIStreamSampleToTime(pavi, AVIStreamStart(pavi))
END FUNCTION
'#define AVIStreamLengthTime(pavi) \
' AVIStreamSampleToTime(pavi, AVIStreamLength(pavi))
FUNCTION AVIStreamLengthTime(BYVAL pavi AS DWORD) AS LONG
 FUNCTION = AVIStreamSampleToTime(pavi, AVIStreamLength(pavi))
END FUNCTION
'#define AVIStreamEnd(pavi) \
' (AVIStreamStart(pavi) + AVIStreamLength(pavi))
FUNCTION AVIStreamEnd(BYVAL pavi AS DWORD) AS LONG
 FUNCTION = AVIStreamStart(pavi) + AVIStreamLength(pavi)
END FUNCTION
'#define AVIStreamEndTime(pavi) \
' AVIStreamSampleToTime(pavi, AVIStreamEnd(pavi))
FUNCTION AVIStreamEndTime(BYVAL pavi AS DWORD) AS LONG
 FUNCTION = AVIStreamSampleToTime(pavi, AVIStreamEnd(pavi))
END FUNCTION
'#define AVIStreamSampleSize(pavi, lPos, plSize) \
' AVIStreamRead(pavi,lPos,1,NULL,0,plSize,NULL)
FUNCTION AVIStreamSampleSize(BYVAL pavi AS DWORD, BYVAL lPos AS LONG, BYVAL plSize AS LONG) AS LONG
 FUNCTION = AVIStreamRead(pavi, lPos, 1, %NULL, 0, plSize, %NULL)
END FUNCTION
'#define AVIStreamFormatSize(pavi, lPos, plSize) \
' AVIStreamReadFormat(pavi,lPos,NULL,plSize)
FUNCTION AVIStreamFormatSize(BYVAL pavi AS DWORD, BYVAL lPos AS LONG, BYVAL plSize AS LONG) AS LONG
 FUNCTION = AVIStreamReadFormat(pavi, lPos, %NULL, plSize)
END FUNCTION
'#define AVIStreamDataSize(pavi, fcc, plSize) \
' AVIStreamReadData(pavi,fcc,NULL,plSize)
FUNCTION AVIStreamDataSize(BYVAL pavi AS DWORD, BYVAL fcc AS DWORD, BYVAL plSize AS LONG) AS LONG
 FUNCTION = AVIStreamReadData(pavi, fcc, %NULL, plSize)
END FUNCTION
'/****************************************************************************
' *
' * AVISave routines and structures
' *
' ***************************************************************************/
'#ifndef comptypeDIB
'#define comptypeDIB mmioFOURCC('D', 'I', 'B', ' ')
'#endif
#IF NOT %DEF(%comptypeDIB)
%EQUATE `comptypeDIB = &H20424944
#ENDIF
DECLARE FUNCTION AVIMakeCompressedStream LIB "avifil32.dll" ALIAS "AVIMakeCompressedStream" ( BYREF ppsCompressed AS QUAD , BYVAL psSource AS QUAD , BYREF lpOptions AS AVICOMPRESSOPTIONS_STRUCT , BYREF pclsidHandler AS GUID ) AS LONG
DECLARE FUNCTION AVISaveA CDECL LIB "avifil32.dll" ALIAS "AVISaveA" ( BYREF szFile AS ASCIIZ
 , BYREF pclsidHandler AS GUID
 , BYVAL lpfnCallback AS DWORD
 , BYVAL nStreams AS LONG
 , BYVAL pfile AS DWORD
 , BYREF lpOptions AS AVICOMPRESSOPTIONS_STRUCT
 , OPTIONAL BYREF ANY ' optional parameters
 , OPTIONAL BYREF ANY , OPTIONAL BYREF ANY , OPTIONAL BYREF ANY , OPTIONAL BYREF ANY , OPTIONAL BYREF ANY , OPTIONAL BYREF ANY , OPTIONAL BYREF ANY , OPTIONAL BYREF ANY , OPTIONAL BYREF ANY , OPTIONAL BYREF ANY , OPTIONAL BYREF ANY , OPTIONAL BYREF ANY , OPTIONAL BYREF ANY , OPTIONAL BYREF ANY , OPTIONAL BYREF ANY ) AS LONG
DECLARE FUNCTION AVISaveW CDECL LIB "avifil32.dll" ALIAS "AVISaveW" ( BYREF szFile AS WSTRINGZ
 , BYREF pclsidHandler AS GUID
 , BYVAL lpfnCallback AS DWORD
 , BYVAL nStreams AS LONG
 , BYVAL pfile AS DWORD
 , BYREF lpOptions AS AVICOMPRESSOPTIONS_STRUCT
 , OPTIONAL BYREF ANY ' optional parameters
 , OPTIONAL BYREF ANY , OPTIONAL BYREF ANY , OPTIONAL BYREF ANY , OPTIONAL BYREF ANY , OPTIONAL BYREF ANY , OPTIONAL BYREF ANY , OPTIONAL BYREF ANY , OPTIONAL BYREF ANY , OPTIONAL BYREF ANY , OPTIONAL BYREF ANY , OPTIONAL BYREF ANY , OPTIONAL BYREF ANY , OPTIONAL BYREF ANY , OPTIONAL BYREF ANY , OPTIONAL BYREF ANY ) AS LONG
#IF %DEF(%UNICODE)
 MACRO AVISave = AVISaveW
#ELSE
 MACRO AVISave = AVISaveA
#ENDIF
DECLARE FUNCTION AVISaveVA LIB "avifil32.dll" ALIAS "AVISaveVA" ( BYREF szFile AS ASCIIZ , BYREF pclsidHandler AS GUID , BYVAL lpfnCallback AS QUAD , BYVAL nStreams AS LONG , BYREF ppavi AS QUAD , BYREF plpOptions AS AVICOMPRESSOPTIONS_STRUCT ) AS LONG
DECLARE FUNCTION AVISaveVW LIB "avifil32.dll" ALIAS "AVISaveVW" ( BYREF szFile AS WSTRINGZ
 , BYREF pclsidHandler AS GUID
 , BYVAL lpfnCallback AS DWORD
 , BYVAL nStreams AS LONG
 , BYREF ppavi AS DWORD
 , BYREF plpOptions AS AVICOMPRESSOPTIONS_STRUCT
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO AVISaveV = AVISaveVW
#ELSE
 MACRO AVISaveV = AVISaveVA
#ENDIF
DECLARE FUNCTION AVISaveOptions LIB "avifil32.dll" ALIAS "AVISaveOptions" ( BYVAL hwnd AS QUAD , BYVAL uiFlags AS QUAD , BYVAL nStreams AS LONG , BYREF ppavi AS QUAD , BYREF plpOptions AS AVICOMPRESSOPTIONS_STRUCT ) AS QUAD ' INT_PTR
DECLARE FUNCTION AVISaveOptionsFree LIB "avifil32.dll" ALIAS "AVISaveOptionsFree" ( BYVAL nStreams AS LONG , BYREF plpOptions AS AVICOMPRESSOPTIONS_STRUCT ) AS QUAD ' INT_PTR
'// FLAGS FOR uiFlags:
'//
'// Same as the flags for ICCompressorChoose (see compman.h)
'// These determine what the compression options dialog for video streams
'// will look like.
DECLARE FUNCTION AVIBuildFilterW LIB "avifil32.dll" ALIAS "AVIBuildFilterW" ( BYREF lpszFilter AS WSTRINGZ , BYVAL fSaving AS LONG ) AS LONG
DECLARE FUNCTION AVIBuildFilterA LIB "avifil32.dll" ALIAS "AVIBuildFilterA" ( BYREF lpszFilter AS ASCIIZ
 , BYVAL fSaving AS LONG
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO AVIBuildFilter = AVIBuildFilterW
#ELSE
 MACRO AVIBuildFilter = AVIBuildFilterA
#ENDIF
DECLARE FUNCTION AVIMakeFileFromStreams LIB "avifil32.dll" ALIAS "AVIMakeFileFromStreams" ( BYVAL nStreams AS LONG , BYREF papStreams AS QUAD ) AS LONG
DECLARE FUNCTION AVIMakeStreamFromClipboard LIB "avifil32.dll" ALIAS "AVIMakeStreamFromClipboard" ( BYVAL cfFormat AS QUAD
 , BYVAL hGlobal AS DWORD
 , BYREF ppstream AS DWORD
 ) AS LONG
'/****************************************************************************
' *
' * Clipboard routines
' *
' ***************************************************************************/
DECLARE FUNCTION AVIPutFileOnClipboard LIB "avifil32.dll" ALIAS "AVIPutFileOnClipboard" ( BYVAL pf AS QUAD ) AS LONG
DECLARE FUNCTION AVIGetFromClipboard LIB "avifil32.dll" ALIAS "AVIGetFromClipboard" ( BYREF lppf AS QUAD
 ) AS LONG
DECLARE SUB AVIClearClipboard LIB "avifil32.dll" ALIAS "AVIClearClipboard" ( ) ' void
'/****************************************************************************
' *
' * Editing routines
' *
' ***************************************************************************/
DECLARE FUNCTION CreateEditableStream LIB "avifil32.dll" ALIAS "CreateEditableStream" ( BYREF ppsEditable AS QUAD , BYVAL psSource AS QUAD ) AS LONG
DECLARE FUNCTION EditStreamCut LIB "avifil32.dll" ALIAS "EditStreamCut" ( BYVAL pavi AS QUAD
 , BYREF plStart AS LONG
 , BYREF plLength AS LONG
 , BYREF ppResult AS DWORD
 ) AS LONG
DECLARE FUNCTION EditStreamCopy LIB "avifil32.dll" ALIAS "EditStreamCopy" ( BYVAL pavi AS DWORD
 , BYREF plStart AS LONG
 , BYREF plLength AS LONG
 , BYREF ppResult AS DWORD
 ) AS LONG
DECLARE FUNCTION EditStreamPaste LIB "avifil32.dll" ALIAS "EditStreamPaste" ( BYVAL pavi AS DWORD
 , BYREF plPos AS LONG
 , BYREF plLength AS LONG
 , BYVAL pstream AS DWORD
 , BYVAL lStart AS LONG
 , BYVAL lEnd AS LONG
 ) AS LONG
DECLARE FUNCTION EditStreamClone LIB "avifil32.dll" ALIAS "EditStreamClone" ( BYVAL pavi AS DWORD
 , BYREF ppResult AS DWORD
 ) AS LONG
DECLARE FUNCTION EditStreamSetNameA LIB "avifil32.dll" ALIAS "EditStreamSetNameA" ( BYVAL pavi AS DWORD
 , BYREF lpszName AS ASCIIZ
 ) AS LONG
DECLARE FUNCTION EditStreamSetNameW LIB "avifil32.dll" ALIAS "EditStreamSetNameW" ( BYVAL pavi AS DWORD
 , BYVAL lpszName AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO EditStreamSetName = EditStreamSetNameW
#ELSE
 MACRO EditStreamSetName = EditStreamSetNameA
#ENDIF
DECLARE FUNCTION EditStreamSetInfoA LIB "avifil32.dll" ALIAS "EditStreamSetInfoA" ( BYVAL pavi AS QUAD , BYREF lpInfo AS AVISTREAMINFOA_STRUCT , BYVAL cbInfo AS LONG ) AS LONG
DECLARE FUNCTION EditStreamSetInfoW LIB "avifil32.dll" ALIAS "EditStreamSetInfoW" ( BYVAL pavi AS QUAD
 , BYREF lpInfo AS AVISTREAMINFOW_STRUCT
 , BYVAL cbInfo AS LONG
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO EditStreamSetInfo = EditStreamSetInfoW
#ELSE
 MACRO EditStreamSetInfo = EditStreamSetInfoA
#ENDIF
'/* - - - - - - - - */
#IF NOT %DEF(%AVIERR_OK)
%EQUATE `AVIERR_OK = 0
'#define MAKE_AVIERR(error) MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x4000 + error)
FUNCTION MAKE_AVIERR (BYVAL dwError AS DWORD) AS DWORD
 FUNCTION = MAKE_SCODE(%SEVERITY_ERROR, %FACILITY_ITF, &H4000 + dwError)
END FUNCTION
'// !!! Questions to be answered:
'// How can you get a string form of these errors?
'// Which of these errors should be replaced by errors in SCODE.H?
%EQUATE `AVIERR_UNSUPPORTED = &H80044065
%EQUATE `AVIERR_BADFORMAT = &H80044066
%EQUATE `AVIERR_MEMORY = &H80044067
%EQUATE `AVIERR_INTERNAL = &H80044068
%EQUATE `AVIERR_BADFLAGS = &H80044069
%EQUATE `AVIERR_BADPARAM = &H8004406A
%EQUATE `AVIERR_BADSIZE = &H8004406B
%EQUATE `AVIERR_BADHANDLE = &H8004406C
%EQUATE `AVIERR_FILEREAD = &H8004406D
%EQUATE `AVIERR_FILEWRITE = &H8004406E
%EQUATE `AVIERR_FILEOPEN = &H8004406F
%EQUATE `AVIERR_COMPRESSOR = &H80044070
%EQUATE `AVIERR_NOCOMPRESSOR = &H80044071
%EQUATE `AVIERR_READONLY = &H80044072
%EQUATE `AVIERR_NODATA = &H80044073
%EQUATE `AVIERR_BUFFERTOOSMALL = &H80044074
%EQUATE `AVIERR_CANTCOMPRESS = &H80044075
%EQUATE `AVIERR_USERABORT = &H800440C6
%EQUATE `AVIERR_ERROR = &H800440C7
'#endif
#ENDIF ' /* NOAVIFILE */ ---------------------------------------------------------------
'/****************************************************************************
' *
' * MCIWnd - Window class for MCI objects
' *
' ***************************************************************************/
#IF NOT %DEF(%NOMCIWND) ' ----------------------------------------------------------------
'/*----------------------------------------------------------------------------*\
' *
' * MCIWnd
' *
' * MCIWnd window class header file.
' *
' * the MCIWnd window class is a window class for controling MCI devices
' * MCI devices include, wave files, midi files, AVI Video, cd audio,
' * vcr, video disc, and others..
' *
' * to learn more about MCI and mci command sets see the
' * "Microsoft Multimedia Programmers's guide" in the Win31 SDK
' *
' * the easiest use of the MCIWnd class is like so:
' *
' * hwnd = MCIWndCreate(hwndParent, hInstance, 0, "chimes.wav");
' * ...
' * MCIWndPlay(hwnd);
' * MCIWndStop(hwnd);
' * MCIWndPause(hwnd);
' * ....
' * MCIWndDestroy(hwnd);
' *
' * this will create a window with a play/pause, stop and a playbar
' * and start the wave file playing.
' *
' * mciwnd.h defines macros for all the most common MCI commands, but
' * any string command can be used if needed.
' *
' * Note: unlike the mciSendString() API, no alias or file name needs
' * to be specifed, since the device to use is implied by the window handle.
' *
' * MCIWndSendString(hwnd, "setaudio stream to 2");
' *
' * (C) Copyright Microsoft Corp. 1991-1995. All rights reserved.
' *
' * You have a royalty-free right to use, modify, reproduce and
' * distribute the Sample Files (and/or any modified version) in
' * any way you find useful, provided that you agree that
' * Microsoft has no warranty obligations or liability for any
' * Sample Application Files.
' *
' * If you did not get this from Microsoft Sources, then it may not be the
' * most current version. This sample code in particular will be updated
' * and include more documentation.
' *
' * Sources are:
' * CompuServe: WINSDK forum, MDK section.
' * Anonymous FTP from ftp.uu.net vendor\microsoft\multimedia
' *
' * WIN32:
' *
' * MCIWnd supports both ansi and unicode interfaces. For any message that
' * takes or returns a text string, two versions of the message are defined,
' * appended with A or W for Ansi or Wide Char. The message or api itself
' * is defined to be one or other of these depending on whether you have
' * UNICODE defined in your application.
' * Thus for the api MCIWndCreate, there are in fact two apis,
' * MCIWndCreateA and MCIWndCreateW. If you call MCIWndCreate, this will be
' * re-routed to MCIWndCreateA unless UNICODE is defined when building your
' * application. In any one application, you can mix calls to the
' * Ansi and Unicode entrypoints.
' *
' * If you use SendMessage instead of the macros below such as MCIWndOpen(),
' * you will see that the messages have changed for WIN32, to support Ansi
' * and Unicode entrypoints. In particular, MCI_OPEN has been replaced by
' * MCWNDM_OPENA, or MCIWNDM_OPENW (MCIWNDM_OPEN is defined to be one or
' * other of these).
' *
' * Also, note that the WIN32 implementation of MCIWnd uses UNICODE
' * so all apis and messages supporting ANSI strings do so by mapping them
' * UNICODE strings and then calling the corresponding UNICODE entrypoint.
' *
' *----------------------------------------------------------------------------*/
'#ifdef __cplusplus
'// MFC Redefines SendMessage, so make sure we get the global one....
'#define MCIWndSM ::SendMessage /* SendMessage in C++*/
'#else
'#define MCIWndSM SendMessage /* SendMessage in C */
'#endif /* __cplusplus */
'#define MCIWND_WINDOW_CLASS TEXT("MCIWndClass")
$MCIWND_WINDOW_CLASS = "MCIWndClass"
DECLARE FUNCTION MCIWndCreateA LIB "msvfw32.dll" ALIAS "MCIWndCreateA" ( BYVAL hwndParent AS QUAD , BYVAL hInstance AS QUAD , BYVAL dwStyle AS QUAD , BYREF szFile AS ASCIIZ ) AS QUAD
DECLARE FUNCTION MCIWndCreateW LIB "msvfw32.dll" ALIAS "MCIWndCreateW" ( BYVAL hwndParent AS QUAD
 , BYVAL hInstance AS DWORD
 , BYVAL dwStyle AS DWORD
 , BYREF szFile AS WSTRINGZ
 ) AS DWORD
#IF %DEF(%UNICODE)
 MACRO MCIWndCreate = MCIWndCreateW
#ELSE
 MACRO MCIWndCreate = MCIWndCreateA
#ENDIF
DECLARE FUNCTION MCIWndRegisterClass LIB "msvfw32.dll" ALIAS "MCIWndRegisterClass" ( ) AS LONG
'// Flags for the MCIWndOpen command
%EQUATE `MCIWNDOPENF_NEW = &H0001 ' // open a new file
'// window styles
%EQUATE `MCIWNDF_NOAUTOSIZEWINDOW = &H0001 ' // when movie size changes
%EQUATE `MCIWNDF_NOPLAYBAR = &H0002 ' // no toolbar
%EQUATE `MCIWNDF_NOAUTOSIZEMOVIE = &H0004 ' // when window size changes
%EQUATE `MCIWNDF_NOMENU = &H0008 ' // no popup menu from RBUTTONDOWN
%EQUATE `MCIWNDF_SHOWNAME = &H0010 ' // show name in caption
%EQUATE `MCIWNDF_SHOWPOS = &H0020 ' // show position in caption
%EQUATE `MCIWNDF_SHOWMODE = &H0040 ' // show mode in caption
%EQUATE `MCIWNDF_SHOWALL = &H0070 ' // show all
%EQUATE `MCIWNDF_NOTIFYMODE = &H0100 ' // tell parent of mode change
%EQUATE `MCIWNDF_NOTIFYPOS = &H0200 ' // tell parent of pos change
%EQUATE `MCIWNDF_NOTIFYSIZE = &H0400 ' // tell parent of size change
%EQUATE `MCIWNDF_NOTIFYERROR = &H1000 ' // tell parent of an error
%EQUATE `MCIWNDF_NOTIFYALL = &H1F00 ' // tell all
%EQUATE `MCIWNDF_NOTIFYANSI = &H0080
'// The MEDIA notification includes a text string.
'// To receive notifications in ANSI instead of unicode set the
'// MCIWNDF_NOTIFYANSI style bit. The macro below includes this bit
'// by default unless you define UNICODE in your application.
%EQUATE `MCIWNDF_NOTIFYMEDIA = &H0880 ' // tell parent of media change
%EQUATE `MCIWNDF_NOTIFYMEDIAA = &H0880 ' // tell parent of media change
%EQUATE `MCIWNDF_NOTIFYMEDIAW = &H0800 ' // tell parent of media change
%EQUATE `MCIWNDF_RECORD = &H2000 ' // Give a record button
%EQUATE `MCIWNDF_NOERRORDLG = &H4000 ' // Show Error Dlgs for MCI cmds?
%EQUATE `MCIWNDF_NOOPEN = &H8000 ' // Don't allow user to open things
'// Messages an app will send to MCIWND
'// all the text-related messages are defined out of order above (they need
'// to be defined before the MCIWndOpen() macros
%EQUATE `MCIWNDM_GETDEVICEID = (%WM_USER + 100)
%EQUATE `MCIWNDM_GETSTART = (%WM_USER + 103)
%EQUATE `MCIWNDM_GETLENGTH = (%WM_USER + 104)
%EQUATE `MCIWNDM_GETEND = (%WM_USER + 105)
%EQUATE `MCIWNDM_EJECT = (%WM_USER + 107)
%EQUATE `MCIWNDM_SETZOOM = (%WM_USER + 108)
%EQUATE `MCIWNDM_GETZOOM = (%WM_USER + 109)
%EQUATE `MCIWNDM_SETVOLUME = (%WM_USER + 110)
%EQUATE `MCIWNDM_GETVOLUME = (%WM_USER + 111)
%EQUATE `MCIWNDM_SETSPEED = (%WM_USER + 112)
%EQUATE `MCIWNDM_GETSPEED = (%WM_USER + 113)
%EQUATE `MCIWNDM_SETREPEAT = (%WM_USER + 114)
%EQUATE `MCIWNDM_GETREPEAT = (%WM_USER + 115)
%EQUATE `MCIWNDM_REALIZE = (%WM_USER + 118)
%EQUATE `MCIWNDM_VALIDATEMEDIA = (%WM_USER + 121)
%EQUATE `MCIWNDM_PLAYFROM = (%WM_USER + 122)
%EQUATE `MCIWNDM_PLAYTO = (%WM_USER + 123)
%EQUATE `MCIWNDM_GETPALETTE = (%WM_USER + 126)
%EQUATE `MCIWNDM_SETPALETTE = (%WM_USER + 127)
%EQUATE `MCIWNDM_SETTIMERS = (%WM_USER + 129)
%EQUATE `MCIWNDM_SETACTIVETIMER = (%WM_USER + 130)
%EQUATE `MCIWNDM_SETINACTIVETIMER = (%WM_USER + 131)
%EQUATE `MCIWNDM_GETACTIVETIMER = (%WM_USER + 132)
%EQUATE `MCIWNDM_GETINACTIVETIMER = (%WM_USER + 133)
%EQUATE `MCIWNDM_CHANGESTYLES = (%WM_USER + 135)
%EQUATE `MCIWNDM_GETSTYLES = (%WM_USER + 136)
%EQUATE `MCIWNDM_GETALIAS = (%WM_USER + 137)
%EQUATE `MCIWNDM_PLAYREVERSE = (%WM_USER + 139)
%EQUATE `MCIWNDM_GET_SOURCE = (%WM_USER + 140)
%EQUATE `MCIWNDM_PUT_SOURCE = (%WM_USER + 141)
%EQUATE `MCIWNDM_GET_DEST = (%WM_USER + 142)
%EQUATE `MCIWNDM_PUT_DEST = (%WM_USER + 143)
%EQUATE `MCIWNDM_CAN_PLAY = (%WM_USER + 144)
%EQUATE `MCIWNDM_CAN_WINDOW = (%WM_USER + 145)
%EQUATE `MCIWNDM_CAN_RECORD = (%WM_USER + 146)
%EQUATE `MCIWNDM_CAN_SAVE = (%WM_USER + 147)
%EQUATE `MCIWNDM_CAN_EJECT = (%WM_USER + 148)
%EQUATE `MCIWNDM_CAN_CONFIG = (%WM_USER + 149)
%EQUATE `MCIWNDM_PALETTEKICK = (%WM_USER + 150)
%EQUATE `MCIWNDM_OPENINTERFACE = (%WM_USER + 151)
%EQUATE `MCIWNDM_SETOWNER = (%WM_USER + 152)
'//define both A and W messages
%EQUATE `MCIWNDM_SENDSTRINGA = (%WM_USER + 101)
%EQUATE `MCIWNDM_GETPOSITIONA = (%WM_USER + 102)
%EQUATE `MCIWNDM_GETMODEA = (%WM_USER + 106)
%EQUATE `MCIWNDM_SETTIMEFORMATA = (%WM_USER + 119)
%EQUATE `MCIWNDM_GETTIMEFORMATA = (%WM_USER + 120)
%EQUATE `MCIWNDM_GETFILENAMEA = (%WM_USER + 124)
%EQUATE `MCIWNDM_GETDEVICEA = (%WM_USER + 125)
%EQUATE `MCIWNDM_GETERRORA = (%WM_USER + 128)
%EQUATE `MCIWNDM_NEWA = (%WM_USER + 134)
%EQUATE `MCIWNDM_RETURNSTRINGA = (%WM_USER + 138)
%EQUATE `MCIWNDM_OPENA = (%WM_USER + 153)
%EQUATE `MCIWNDM_SENDSTRINGW = (%WM_USER + 201)
%EQUATE `MCIWNDM_GETPOSITIONW = (%WM_USER + 202)
%EQUATE `MCIWNDM_GETMODEW = (%WM_USER + 206)
%EQUATE `MCIWNDM_SETTIMEFORMATW = (%WM_USER + 219)
%EQUATE `MCIWNDM_GETTIMEFORMATW = (%WM_USER + 220)
%EQUATE `MCIWNDM_GETFILENAMEW = (%WM_USER + 224)
%EQUATE `MCIWNDM_GETDEVICEW = (%WM_USER + 225)
%EQUATE `MCIWNDM_GETERRORW = (%WM_USER + 228)
%EQUATE `MCIWNDM_NEWW = (%WM_USER + 234)
%EQUATE `MCIWNDM_RETURNSTRINGW = (%WM_USER + 238)
%EQUATE `MCIWNDM_OPENW = (%WM_USER + 252)
'// map defaults to A or W depending on app's UNICODE setting
'#ifdef UNICODE
'#define MCIWNDM_SENDSTRING MCIWNDM_SENDSTRINGW
'#define MCIWNDM_GETPOSITION MCIWNDM_GETPOSITIONW
'#define MCIWNDM_GETMODE MCIWNDM_GETMODEW
'#define MCIWNDM_SETTIMEFORMAT MCIWNDM_SETTIMEFORMATW
'#define MCIWNDM_GETTIMEFORMAT MCIWNDM_GETTIMEFORMATW
'#define MCIWNDM_GETFILENAME MCIWNDM_GETFILENAMEW
'#define MCIWNDM_GETDEVICE MCIWNDM_GETDEVICEW
'#define MCIWNDM_GETERROR MCIWNDM_GETERRORW
'#define MCIWNDM_NEW MCIWNDM_NEWW
'#define MCIWNDM_RETURNSTRING MCIWNDM_RETURNSTRINGW
'#define MCIWNDM_OPEN MCIWNDM_OPENW
'#else
'#define MCIWNDM_SENDSTRING MCIWNDM_SENDSTRINGA
'#define MCIWNDM_GETPOSITION MCIWNDM_GETPOSITIONA
'#define MCIWNDM_GETMODE MCIWNDM_GETMODEA
'#define MCIWNDM_SETTIMEFORMAT MCIWNDM_SETTIMEFORMATA
'#define MCIWNDM_GETTIMEFORMAT MCIWNDM_GETTIMEFORMATA
'#define MCIWNDM_GETFILENAME MCIWNDM_GETFILENAMEA
'#define MCIWNDM_GETDEVICE MCIWNDM_GETDEVICEA
'#define MCIWNDM_GETERROR MCIWNDM_GETERRORA
'#define MCIWNDM_NEW MCIWNDM_NEWA
'#define MCIWNDM_RETURNSTRING MCIWNDM_RETURNSTRINGA
'#define MCIWNDM_OPEN MCIWNDM_OPENA
'#endif
%EQUATE `MCIWNDM_SENDSTRING = %MCIWNDM_SENDSTRINGA
%EQUATE `MCIWNDM_GETPOSITION = %MCIWNDM_GETPOSITIONA
%EQUATE `MCIWNDM_GETMODE = %MCIWNDM_GETMODEA
%EQUATE `MCIWNDM_SETTIMEFORMAT = %MCIWNDM_SETTIMEFORMATA
%EQUATE `MCIWNDM_GETTIMEFORMAT = %MCIWNDM_GETTIMEFORMATA
%EQUATE `MCIWNDM_GETFILENAME = %MCIWNDM_GETFILENAMEA
%EQUATE `MCIWNDM_GETDEVICE = %MCIWNDM_GETDEVICEA
%EQUATE `MCIWNDM_GETERROR = %MCIWNDM_GETERRORA
%EQUATE `MCIWNDM_NEW = %MCIWNDM_NEWA
%EQUATE `MCIWNDM_RETURNSTRING = %MCIWNDM_RETURNSTRINGA
%EQUATE `MCIWNDM_OPEN = %MCIWNDM_OPENA
'// note that the source text for MCIWND will thus contain
'// support for eg MCIWNDM_SENDSTRING (both the 16-bit entrypoint and
'// in win32 mapped to MCIWNDM_SENDSTRINGW), and MCIWNDM_SENDSTRINGA (the
'// win32 ansi thunk).
'// Messages MCIWND will send to an app
'// !!! Use less messages and use a code instead to indicate the type of notify? /* ;Internal */
%EQUATE `MCIWNDM_NOTIFYMODE = (%WM_USER + 200) ' // wp = hwnd, lp = mode
%EQUATE `MCIWNDM_NOTIFYPOS = (%WM_USER + 201) ' // wp = hwnd, lp = pos
%EQUATE `MCIWNDM_NOTIFYSIZE = (%WM_USER + 202) ' // wp = hwnd
%EQUATE `MCIWNDM_NOTIFYMEDIA = (%WM_USER + 203) ' // wp = hwnd, lp = fn
%EQUATE `MCIWNDM_NOTIFYERROR = (%WM_USER + 205) ' // wp = hwnd, lp = error
'// special seek values for START and END
%EQUATE `MCIWND_START = -1
%EQUATE `MCIWND_END = -2
'#ifndef MCI_PLAY
' /* MCI command message identifiers */
'#ifndef _WIN32
' // win32 apps send MCIWNDM_OPEN
' #define MCI_OPEN 0x0803
'#endif
' #define MCI_CLOSE 0x0804
' #define MCI_PLAY 0x0806
' #define MCI_SEEK 0x0807
' #define MCI_STOP 0x0808
' #define MCI_PAUSE 0x0809
' #define MCI_STEP 0x080E
' #define MCI_RECORD 0x080F
' #define MCI_SAVE 0x0813
' #define MCI_CUT 0x0851
' #define MCI_COPY 0x0852
' #define MCI_PASTE 0x0853
' #define MCI_RESUME 0x0855
' #define MCI_DELETE 0x0856
'#endif
%EQUATE `MCI_CLOSE = &H0804
%EQUATE `MCI_PLAY = &H0806
%EQUATE `MCI_SEEK = &H0807
%EQUATE `MCI_STOP = &H0808
%EQUATE `MCI_PAUSE = &H0809
%EQUATE `MCI_STEP = &H080E
%EQUATE `MCI_RECORD = &H080F
%EQUATE `MCI_SAVE = &H0813
%EQUATE `MCI_CUT = &H0851
%EQUATE `MCI_COPY = &H0852
%EQUATE `MCI_PASTE = &H0853
%EQUATE `MCI_RESUME = &H0855
%EQUATE `MCI_DELETE = &H0856
' /* return values for 'status mode' command */
%EQUATE `MCI_MODE_NOT_READY = 524
%EQUATE `MCI_MODE_STOP = 525
%EQUATE `MCI_MODE_PLAY = 526
%EQUATE `MCI_MODE_RECORD = 527
%EQUATE `MCI_MODE_SEEK = 528
%EQUATE `MCI_MODE_PAUSE = 529
%EQUATE `MCI_MODE_OPEN = 530
'// can macros
'#define MCIWndCanPlay(hwnd) (BOOL)MCIWndSM(hwnd,MCIWNDM_CAN_PLAY,0,0)
FUNCTION MCIWndCanPlay (BYVAL hwnd AS DWORD) AS LONG
 FUNCTION = SendMessage(hwnd, %MCIWNDM_CAN_PLAY, 0, 0)
END FUNCTION
'#define MCIWndCanRecord(hwnd) (BOOL)MCIWndSM(hwnd,MCIWNDM_CAN_RECORD,0,0)
FUNCTION MCIWndCanRecord (BYVAL hwnd AS DWORD) AS LONG
 FUNCTION = SendMessage(hwnd, %MCIWNDM_CAN_RECORD, 0, 0)
END FUNCTION
'#define MCIWndCanSave(hwnd) (BOOL)MCIWndSM(hwnd,MCIWNDM_CAN_SAVE,0,0)
FUNCTION MCIWndCanSave (BYVAL hwnd AS DWORD) AS LONG
 FUNCTION = SendMessage(hwnd, %MCIWNDM_CAN_SAVE, 0, 0)
END FUNCTION
'#define MCIWndCanWindow(hwnd) (BOOL)MCIWndSM(hwnd,MCIWNDM_CAN_WINDOW,0,0)
FUNCTION MCIWndCanWindow (BYVAL hwnd AS DWORD) AS LONG
 FUNCTION = SendMessage(hwnd, %MCIWNDM_CAN_WINDOW, 0, 0)
END FUNCTION
'#define MCIWndCanEject(hwnd) (BOOL)MCIWndSM(hwnd,MCIWNDM_CAN_EJECT,0,0)
FUNCTION MCIWndCanEject (BYVAL hwnd AS DWORD) AS LONG
 FUNCTION = SendMessage(hwnd, %MCIWNDM_CAN_EJECT, 0, 0)
END FUNCTION
'#define MCIWndCanConfig(hwnd) (BOOL)MCIWndSM(hwnd,MCIWNDM_CAN_CONFIG,0,0)
FUNCTION MCIWndCanConfig (BYVAL hwnd AS DWORD) AS LONG
 FUNCTION = SendMessage(hwnd, %MCIWNDM_CAN_CONFIG, 0, 0)
END FUNCTION
'#define MCIWndPaletteKick(hwnd) (BOOL)MCIWndSM(hwnd,MCIWNDM_PALETTEKICK,0,0)
FUNCTION MCIWndPaletteKick (BYVAL hwnd AS DWORD) AS LONG
 FUNCTION = SendMessage(hwnd, %MCIWNDM_PALETTEKICK, 0, 0)
END FUNCTION
'#define MCIWndSave(hwnd, szFile) (LONG)MCIWndSM(hwnd, MCI_SAVE, 0, (LPARAM)(LPVOID)(szFile))
FUNCTION MCIWndSave (BYVAL hwnd AS DWORD, BYREF szFile AS ASCIIZ) AS LONG
 FUNCTION = SendMessage(hwnd, %MCI_SAVE, 0, BYVAL VARPTR(szFile))
END FUNCTION
'#define MCIWndSaveDialog(hwnd) MCIWndSave(hwnd, -1)
FUNCTION MCIWndSaveDialog (BYVAL hwnd AS DWORD) AS LONG
 FUNCTION = SendMessage(hwnd, %MCI_SAVE, 0, -1)
END FUNCTION
'// if you dont give a device it will use the current device....
'#define MCIWndNew(hwnd, lp) (LONG)MCIWndSM(hwnd, MCIWNDM_NEW, 0, (LPARAM)(LPVOID)(lp))
FUNCTION MCIWndNew (BYVAL hwnd AS DWORD, BYVAL lp AS DWORD) AS LONG
 FUNCTION = SendMessage(hwnd, %MCIWNDM_NEW, 0, lp)
END FUNCTION
'#define MCIWndRecord(hwnd) (LONG)MCIWndSM(hwnd, MCI_RECORD, 0, 0)
FUNCTION MCIWndRecord (BYVAL hwnd AS DWORD) AS LONG
 FUNCTION = SendMessage(hwnd, %MCI_RECORD, 0, 0)
END FUNCTION
'#define MCIWndOpen(hwnd, sz, f) (LONG)MCIWndSM(hwnd, MCIWNDM_OPEN, (WPARAM)(UINT)(f),(LPARAM)(LPVOID)(sz))
FUNCTION MCIWndOpen (BYVAL hwnd AS DWORD, BYREF szFile AS ASCIIZ, BYVAL wFlags AS WORD) AS LONG
 FUNCTION = SendMessage(hwnd, %MCIWNDM_OPEN, BYVAL VARPTR(szFile), wFlags)
END FUNCTION
'#define MCIWndOpenDialog(hwnd) MCIWndOpen(hwnd, -1, 0)
FUNCTION MCIWndOpenDialog (BYVAL hwnd AS DWORD) AS LONG
 FUNCTION = SendMessage(hwnd, %MCIWNDM_OPEN, -1, 0)
END FUNCTION
'#define MCIWndClose(hwnd) (LONG)MCIWndSM(hwnd, MCI_CLOSE, 0, 0)
FUNCTION MCIWndClose (BYVAL hwnd AS DWORD) AS LONG
 FUNCTION = SendMessage(hwnd, %MCI_CLOSE, 0, 0)
END FUNCTION
'#define MCIWndPlay(hwnd) (LONG)MCIWndSM(hwnd, MCI_PLAY, 0, 0)
FUNCTION MCIWndPlay (BYVAL hwnd AS DWORD) AS LONG
 FUNCTION = SendMessage(hwnd, %MCI_PLAY, 0, 0)
END FUNCTION
'#define MCIWndStop(hwnd) (LONG)MCIWndSM(hwnd, MCI_STOP, 0, 0)
FUNCTION MCIWndStop (BYVAL hwnd AS DWORD) AS LONG
 FUNCTION = SendMessage(hwnd, %MCI_STOP, 0, 0)
END FUNCTION
'#define MCIWndPause(hwnd) (LONG)MCIWndSM(hwnd, MCI_PAUSE, 0, 0)
FUNCTION MCIWndPause (BYVAL hwnd AS DWORD) AS LONG
 FUNCTION = SendMessage(hwnd, %MCI_PAUSE, 0, 0)
END FUNCTION
'#define MCIWndResume(hwnd) (LONG)MCIWndSM(hwnd, MCI_RESUME, 0, 0)
FUNCTION MCIWndResume (BYVAL hwnd AS DWORD) AS LONG
 FUNCTION = SendMessage(hwnd, %MCI_RESUME, 0, 0)
END FUNCTION
'#define MCIWndSeek(hwnd, lPos) (LONG)MCIWndSM(hwnd, MCI_SEEK, 0, (LPARAM)(LONG)(lPos))
FUNCTION MCIWndSeek (BYVAL hwnd AS DWORD, BYVAL lPos AS LONG) AS LONG
 FUNCTION = SendMessage(hwnd, %MCI_SEEK, 0, lPos)
END FUNCTION
'#define MCIWndEject(hwnd) (LONG)MCIWndSM(hwnd, MCIWNDM_EJECT, 0, 0)
FUNCTION MCIWndEject (BYVAL hwnd AS DWORD) AS LONG
 FUNCTION = SendMessage(hwnd, %MCIWNDM_EJECT, 0, 0)
END FUNCTION
'#define MCIWndHome(hwnd) MCIWndSeek(hwnd, MCIWND_START)
FUNCTION MCIWndHome (BYVAL hwnd AS DWORD) AS LONG
 FUNCTION = SendMessage(hwnd, %MCI_SEEK, 0, %MCIWND_START)
END FUNCTION
'#define MCIWndEnd(hwnd) MCIWndSeek(hwnd, MCIWND_END)
FUNCTION MCIWndEnd (BYVAL hwnd AS DWORD) AS LONG
 FUNCTION = SendMessage(hwnd, %MCI_SEEK, 0, %MCIWND_END)
END FUNCTION
'#define MCIWndGetSource(hwnd, prc) (LONG)MCIWndSM(hwnd, MCIWNDM_GET_SOURCE, 0, (LPARAM)(LPRECT)(prc))
FUNCTION MCIWndGetSource (BYVAL hwnd AS DWORD, BYREF prc AS RECT) AS LONG
 FUNCTION = SendMessage(hwnd, %MCIWNDM_GET_SOURCE, 0, BYVAL VARPTR(prc))
END FUNCTION
'#define MCIWndPutSource(hwnd, prc) (LONG)MCIWndSM(hwnd, MCIWNDM_PUT_SOURCE, 0, (LPARAM)(LPRECT)(prc))
FUNCTION MCIWndPutSource (BYVAL hwnd AS DWORD, BYREF prc AS RECT) AS LONG
 FUNCTION = SendMessage(hwnd, %MCIWNDM_PUT_SOURCE, 0, BYVAL VARPTR(prc))
END FUNCTION
'#define MCIWndGetDest(hwnd, prc) (LONG)MCIWndSM(hwnd, MCIWNDM_GET_DEST, 0, (LPARAM)(LPRECT)(prc))
FUNCTION MCIWndGetDest (BYVAL hwnd AS DWORD, BYREF prc AS RECT) AS LONG
 FUNCTION = SendMessage(hwnd, %MCIWNDM_GET_DEST, 0, BYVAL VARPTR(prc))
END FUNCTION
'#define MCIWndPutDest(hwnd, prc) (LONG)MCIWndSM(hwnd, MCIWNDM_PUT_DEST, 0, (LPARAM)(LPRECT)(prc))
FUNCTION MCIWndPutDest (BYVAL hwnd AS DWORD, BYREF prc AS RECT) AS LONG
 FUNCTION = SendMessage(hwnd, %MCIWNDM_PUT_DEST, 0, BYVAL VARPTR(prc))
END FUNCTION
'#define MCIWndPlayReverse(hwnd) (LONG)MCIWndSM(hwnd, MCIWNDM_PLAYREVERSE, 0, 0)
FUNCTION MCIWndPlayReverse (BYVAL hwnd AS DWORD) AS LONG
 FUNCTION = SendMessage(hwnd, %MCIWNDM_PLAYREVERSE, 0, 0)
END FUNCTION
'#define MCIWndPlayFrom(hwnd, lPos) (LONG)MCIWndSM(hwnd, MCIWNDM_PLAYFROM, 0, (LPARAM)(LONG)(lPos))
FUNCTION MCIWndPlayFrom (BYVAL hwnd AS DWORD, BYVAL lPos AS LONG) AS LONG
 FUNCTION = SendMessage(hwnd, %MCIWNDM_PLAYFROM, 0, lPos)
END FUNCTION
'#define MCIWndPlayTo(hwnd, lPos) (LONG)MCIWndSM(hwnd, MCIWNDM_PLAYTO, 0, (LPARAM)(LONG)(lPos))
FUNCTION MCIWndPlayTo (BYVAL hwnd AS DWORD, BYVAL lPos AS LONG) AS LONG
 FUNCTION = SendMessage(hwnd, %MCIWNDM_PLAYTO, 0, lPos)
END FUNCTION
'#define MCIWndPlayFromTo(hwnd, lStart, lEnd) (MCIWndSeek(hwnd, lStart), MCIWndPlayTo(hwnd, lEnd))
FUNCTION MCIWndPlayFromTo (BYVAL hwnd AS DWORD, BYVAL lStart AS LONG, BYVAL lEnd AS LONG) AS LONG
 LOCAL hr AS LONG
 hr = MCIWndSeek(hwnd, lStart)
 IF hr = 0 THEN
 hr = MCIWndPlayTo(hwnd, lEnd)
 END IF
 FUNCTION = hr
END FUNCTION
'#define MCIWndGetDeviceID(hwnd) (UINT)MCIWndSM(hwnd, MCIWNDM_GETDEVICEID, 0, 0)
FUNCTION MCIWndGetDeviceID (BYVAL hwnd AS DWORD) AS LONG
 FUNCTION = SendMessage(hwnd, %MCIWNDM_GETDEVICEID, 0, 0)
END FUNCTION
'#define MCIWndGetAlias(hwnd) (UINT)MCIWndSM(hwnd, MCIWNDM_GETALIAS, 0, 0)
FUNCTION MCIWndGetAlias (BYVAL hwnd AS DWORD) AS LONG
 FUNCTION = SendMessage(hwnd, %MCIWNDM_GETALIAS, 0, 0)
END FUNCTION
'#define MCIWndGetMode(hwnd, lp, len) (LONG)MCIWndSM(hwnd, MCIWNDM_GETMODE, (WPARAM)(UINT)(len), (LPARAM)(LPTSTR)(lp))
FUNCTION MCIWndGetMode (BYVAL hwnd AS DWORD, BYREF lp AS ASCIIZ, BYVAL ln AS DWORD) AS LONG
 FUNCTION = SendMessage(hwnd, %MCIWNDM_GETMODE, ln, BYVAL VARPTR(lp))
END FUNCTION
'#define MCIWndGetPosition(hwnd) (LONG)MCIWndSM(hwnd, MCIWNDM_GETPOSITION, 0, 0)
FUNCTION MCIWndGetPosition (BYVAL hwnd AS DWORD) AS LONG
 FUNCTION = SendMessage(hwnd, %MCIWNDM_GETPOSITION, 0, 0)
END FUNCTION
'#define MCIWndGetPositionString(hwnd, lp, len) (LONG)MCIWndSM(hwnd, MCIWNDM_GETPOSITION, (WPARAM)(UINT)(len), (LPARAM)(LPTSTR)(lp))
FUNCTION MCIWndGetPositionString (BYVAL hwnd AS DWORD, BYREF lp AS ASCIIZ, BYVAL ln AS DWORD) AS LONG
 FUNCTION = SendMessage(hwnd, %MCIWNDM_GETPOSITION, ln, BYVAL VARPTR(lp))
END FUNCTION
'#define MCIWndGetStart(hwnd) (LONG)MCIWndSM(hwnd, MCIWNDM_GETSTART, 0, 0)
FUNCTION MCIWndGetStart (BYVAL hwnd AS DWORD) AS LONG
 FUNCTION = SendMessage(hwnd, %MCIWNDM_GETSTART, 0, 0)
END FUNCTION
'#define MCIWndGetLength(hwnd) (LONG)MCIWndSM(hwnd, MCIWNDM_GETLENGTH, 0, 0)
FUNCTION MCIWndGetLength (BYVAL hwnd AS DWORD) AS LONG
 FUNCTION = SendMessage(hwnd, %MCIWNDM_GETLENGTH, 0, 0)
END FUNCTION
'#define MCIWndGetEnd(hwnd) (LONG)MCIWndSM(hwnd, MCIWNDM_GETEND, 0, 0)
FUNCTION MCIWndGetEnd (BYVAL hwnd AS DWORD) AS LONG
 FUNCTION = SendMessage(hwnd, %MCIWNDM_GETEND, 0, 0)
END FUNCTION
'#define MCIWndStep(hwnd, n) (LONG)MCIWndSM(hwnd, MCI_STEP, 0,(LPARAM)(long)(n))
FUNCTION MCIWndStep (BYVAL hwnd AS DWORD, BYVAL n AS LONG) AS LONG
 FUNCTION = SendMessage(hwnd, %MCI_STEP, 0, n)
END FUNCTION
'#define MCIWndDestroy(hwnd) (VOID)MCIWndSM(hwnd, WM_CLOSE, 0, 0)
SUB MCIWndDestroy (BYVAL hwnd AS DWORD)
 SendMessage hwnd, %WM_CLOSE, 0, 0
END SUB
'#define MCIWndSetZoom(hwnd,iZoom) (VOID)MCIWndSM(hwnd, MCIWNDM_SETZOOM, 0, (LPARAM)(UINT)(iZoom))
SUB MCIWndSetZoom (BYVAL hwnd AS DWORD, BYVAL iZoom AS INTEGER)
 SendMessage hwnd, %MCIWNDM_SETZOOM, 0, iZoom
END SUB
'#define MCIWndGetZoom(hwnd) (UINT)MCIWndSM(hwnd, MCIWNDM_GETZOOM, 0, 0)
FUNCTION MCIWndGetZoom (BYVAL hwnd AS DWORD) AS LONG
 FUNCTION = SendMessage(hwnd, %MCIWNDM_GETZOOM, 0, 0)
END FUNCTION
'#define MCIWndSetVolume(hwnd,iVol) (LONG)MCIWndSM(hwnd, MCIWNDM_SETVOLUME, 0, (LPARAM)(UINT)(iVol))
FUNCTION MCIWndSetVolume (BYVAL hwnd AS DWORD, BYVAL iVol AS INTEGER) AS LONG
 FUNCTION = SendMessage(hwnd, %MCIWNDM_SETVOLUME, 0, iVol)
END FUNCTION
'#define MCIWndGetVolume(hwnd) (LONG)MCIWndSM(hwnd, MCIWNDM_GETVOLUME, 0, 0)
FUNCTION MCIWndGetVolume (BYVAL hwnd AS DWORD) AS LONG
 FUNCTION = SendMessage(hwnd, %MCIWNDM_GETVOLUME, 0, 0)
END FUNCTION
'#define MCIWndSetSpeed(hwnd,iSpeed) (LONG)MCIWndSM(hwnd, MCIWNDM_SETSPEED, 0, (LPARAM)(UINT)(iSpeed))
FUNCTION MCIWndSetSpeed (BYVAL hwnd AS DWORD, BYVAL iSpeed AS INTEGER) AS LONG
 FUNCTION = SendMessage(hwnd, %MCIWNDM_SETSPEED, 0, iSpeed)
END FUNCTION
'#define MCIWndGetSpeed(hwnd) (LONG)MCIWndSM(hwnd, MCIWNDM_GETSPEED, 0, 0)
FUNCTION MCIWndGetSpeed (BYVAL hwnd AS DWORD) AS LONG
 FUNCTION = SendMessage(hwnd, %MCIWNDM_GETSPEED, 0, 0)
END FUNCTION
'#define MCIWndSetTimeFormat(hwnd, lp) (LONG)MCIWndSM(hwnd, MCIWNDM_SETTIMEFORMAT, 0, (LPARAM)(LPTSTR)(lp))
FUNCTION MCIWndSetTimeFormat (BYVAL hwnd AS DWORD, BYREF lp AS ASCIIZ) AS LONG
 FUNCTION = SendMessage(hwnd, %MCIWNDM_SETTIMEFORMAT, 0, BYVAL VARPTR(lp))
END FUNCTION
'#define MCIWndGetTimeFormat(hwnd, lp, len) (LONG)MCIWndSM(hwnd, MCIWNDM_GETTIMEFORMAT, (WPARAM)(UINT)(len), (LPARAM)(LPTSTR)(lp))
FUNCTION MCIWndGetTimeFormat (BYVAL hwnd AS DWORD, BYREF lp AS ASCIIZ, BYVAL ln AS DWORD) AS LONG
 FUNCTION = SendMessage(hwnd, %MCIWNDM_GETTIMEFORMAT, ln, BYVAL VARPTR(lp))
END FUNCTION
'#define MCIWndValidateMedia(hwnd) (VOID)MCIWndSM(hwnd, MCIWNDM_VALIDATEMEDIA, 0, 0)
SUB MCIWndValidateMedia (BYVAL hwnd AS DWORD)
 SendMessage hwnd, %MCIWNDM_VALIDATEMEDIA, 0, 0
END SUB
'#define MCIWndSetRepeat(hwnd,f) (void)MCIWndSM(hwnd, MCIWNDM_SETREPEAT, 0, (LPARAM)(BOOL)(f))
SUB MCIWndSetRepeat (BYVAL hwnd AS DWORD, BYVAL f AS WORD)
 SendMessage hwnd, %MCIWNDM_SETREPEAT, 0, f
END SUB
'#define MCIWndGetRepeat(hwnd) (BOOL)MCIWndSM(hwnd, MCIWNDM_GETREPEAT, 0, 0)
SUB MCIWndGetRepeat (BYVAL hwnd AS DWORD)
 SendMessage hwnd, %MCIWNDM_GETREPEAT, 0, 0
END SUB
'#define MCIWndUseFrames(hwnd) MCIWndSetTimeFormat(hwnd, TEXT("frames"))
FUNCTION MCIWndUseFrames (BYVAL hwnd AS DWORD) AS LONG
 LOCAL sz AS ASCIIZ * 7
 sz = "frames"
 FUNCTION = SendMessage(hwnd, %MCIWNDM_SETTIMEFORMAT, 0, BYVAL VARPTR(sz))
END FUNCTION
'#define MCIWndUseTime(hwnd) MCIWndSetTimeFormat(hwnd, TEXT("ms"))
FUNCTION MCIWndUseTime (BYVAL hwnd AS DWORD) AS LONG
 LOCAL sz AS ASCIIZ * 3
 sz = "ms"
 FUNCTION = SendMessage(hwnd, %MCIWNDM_SETTIMEFORMAT, 0, BYVAL VARPTR(sz))
END FUNCTION
'#define MCIWndSetActiveTimer(hwnd, active) \
' (VOID)MCIWndSM(hwnd, MCIWNDM_SETACTIVETIMER, \
' (WPARAM)(UINT)(active), 0L)
FUNCTION MCIWndSetActiveTimer (BYVAL hwnd AS DWORD, BYVAL active AS DWORD) AS LONG
 FUNCTION = SendMessage(hwnd, %MCIWNDM_SETTIMEFORMAT, active, 0)
END FUNCTION
'#define MCIWndSetInactiveTimer(hwnd, inactive) \
' (VOID)MCIWndSM(hwnd, MCIWNDM_SETINACTIVETIMER, \
' (WPARAM)(UINT)(inactive), 0L)
FUNCTION MCIWndSetInactiveTimer (BYVAL hwnd AS DWORD, BYVAL inactive AS DWORD) AS LONG
 FUNCTION = SendMessage(hwnd, %MCIWNDM_SETINACTIVETIMER, inactive, 0)
END FUNCTION
'#define MCIWndSetTimers(hwnd, active, inactive) \
' (VOID)MCIWndSM(hwnd, MCIWNDM_SETTIMERS,(WPARAM)(UINT)(active), \
' (LPARAM)(UINT)(inactive))
FUNCTION MCIWndSetTimers (BYVAL hwnd AS DWORD, BYVAL active AS DWORD, BYVAL inactive AS DWORD) AS LONG
 FUNCTION = SendMessage(hwnd, %MCIWNDM_SETTIMERS, active, inactive)
END FUNCTION
'#define MCIWndGetActiveTimer(hwnd) \
' (UINT)MCIWndSM(hwnd, MCIWNDM_GETACTIVETIMER, 0, 0L);
FUNCTION MCIWndGetActiveTimer (BYVAL hwnd AS DWORD) AS LONG
 FUNCTION = SendMessage(hwnd, %MCIWNDM_GETACTIVETIMER, 0, 0)
END FUNCTION
'#define MCIWndGetInactiveTimer(hwnd) \
' (UINT)MCIWndSM(hwnd, MCIWNDM_GETINACTIVETIMER, 0, 0L);
FUNCTION MCIWndGetInactiveTimer (BYVAL hwnd AS DWORD) AS LONG
 FUNCTION = SendMessage(hwnd, %MCIWNDM_GETINACTIVETIMER, 0, 0)
END FUNCTION
'#define MCIWndRealize(hwnd, fBkgnd) (LONG)MCIWndSM(hwnd, MCIWNDM_REALIZE,(WPARAM)(BOOL)(fBkgnd),0)
FUNCTION MCIWndRealize (BYVAL hwnd AS DWORD, BYVAL fBkgnd AS DWORD) AS LONG
 FUNCTION = SendMessage(hwnd, %MCIWNDM_REALIZE, fBkgnd, 0)
END FUNCTION
'#define MCIWndSendString(hwnd, sz) (LONG)MCIWndSM(hwnd, MCIWNDM_SENDSTRING, 0, (LPARAM)(LPTSTR)(sz))
FUNCTION MCIWndSendString (BYVAL hwnd AS DWORD, BYREF sz AS ASCIIZ) AS LONG
 FUNCTION = SendMessage(hwnd, %MCIWNDM_SENDSTRING, 0, BYVAL VARPTR(sz))
END FUNCTION
'#define MCIWndReturnString(hwnd, lp, len) (LONG)MCIWndSM(hwnd, MCIWNDM_RETURNSTRING, (WPARAM)(UINT)(len), (LPARAM)(LPVOID)(lp))
FUNCTION MCIWndReturnString (BYVAL hwnd AS DWORD, BYREF sz AS ASCIIZ, BYVAL ln AS DWORD) AS LONG
 FUNCTION = SendMessage(hwnd, %MCIWNDM_RETURNSTRING, ln, BYVAL VARPTR(sz))
END FUNCTION
'#define MCIWndGetError(hwnd, lp, len) (LONG)MCIWndSM(hwnd, MCIWNDM_GETERROR, (WPARAM)(UINT)(len), (LPARAM)(LPVOID)(lp))
FUNCTION MCIWndGetError (BYVAL hwnd AS DWORD, BYREF lp AS ASCIIZ, BYVAL ln AS DWORD) AS LONG
 FUNCTION = SendMessage(hwnd, %MCIWNDM_GETERROR, ln, BYVAL VARPTR(lp))
END FUNCTION
'//#define MCIWndActivate(hwnd, f) (void)MCIWndSM(hwnd, WM_ACTIVATE, (WPARAM)(BOOL)(f), 0)
'FUNCTION MCIWndActivate (BYVAL hwnd AS DWORD, BYVAL fAS DWORD) AS LONG
' FUNCTION = SendMessage(hwnd, %WM_ACTIVATE, f, 0)
'END FUNCTION
'#define MCIWndGetPalette(hwnd) (HPALETTE)MCIWndSM(hwnd, MCIWNDM_GETPALETTE, 0, 0)
FUNCTION MCIWndGetPalette (BYVAL hwnd AS DWORD) AS LONG
 FUNCTION = SendMessage(hwnd, %MCIWNDM_GETPALETTE, 0, 0)
END FUNCTION
'#define MCIWndSetPalette(hwnd, hpal) (LONG)MCIWndSM(hwnd, MCIWNDM_SETPALETTE, (WPARAM)(HPALETTE)(hpal), 0)
FUNCTION MCIWndSetPalette (BYVAL hwnd AS DWORD, BYVAL hPal AS DWORD) AS LONG
 FUNCTION = SendMessage(hwnd, %MCIWNDM_SETPALETTE, hPal, 0)
END FUNCTION
'#define MCIWndGetFileName(hwnd, lp, len) (LONG)MCIWndSM(hwnd, MCIWNDM_GETFILENAME, (WPARAM)(UINT)(len), (LPARAM)(LPVOID)(lp))
FUNCTION MCIWndGetFileName (BYVAL hwnd AS DWORD, BYREF lp AS ASCIIZ, BYVAL ln AS DWORD) AS LONG
 FUNCTION = SendMessage(hwnd, %MCIWNDM_SETPALETTE, ln, BYVAL VARPTR(lp))
END FUNCTION
'#define MCIWndGetDevice(hwnd, lp, len) (LONG)MCIWndSM(hwnd, MCIWNDM_GETDEVICE, (WPARAM)(UINT)(len), (LPARAM)(LPVOID)(lp))
FUNCTION MCIWndGetDevice (BYVAL hwnd AS DWORD, BYREF lp AS ASCIIZ, BYVAL ln AS DWORD) AS LONG
 FUNCTION = SendMessage(hwnd, %MCIWNDM_GETDEVICE, ln, BYVAL VARPTR(lp))
END FUNCTION
'#define MCIWndGetStyles(hwnd) (UINT)MCIWndSM(hwnd, MCIWNDM_GETSTYLES, 0, 0L)
FUNCTION MCIWndGetStyles (BYVAL hwnd AS DWORD) AS LONG
 FUNCTION = SendMessage(hwnd, %MCIWNDM_GETSTYLES, 0, 0)
END FUNCTION
'#define MCIWndChangeStyles(hwnd, mask, value) (LONG)MCIWndSM(hwnd, MCIWNDM_CHANGESTYLES, (WPARAM)(UINT)(mask), (LPARAM)(LONG)(value))
FUNCTION MCIWndChangeStyles (BYVAL hwnd AS DWORD, BYVAL mask AS DWORD, BYVAL value AS LONG) AS LONG
 FUNCTION = SendMessage(hwnd, %MCIWNDM_CHANGESTYLES, mask, value)
END FUNCTION
'#define MCIWndOpenInterface(hwnd, pUnk) (LONG)MCIWndSM(hwnd, MCIWNDM_OPENINTERFACE, 0, (LPARAM)(LPUNKNOWN)(pUnk))
FUNCTION MCIWndOpenInterface (BYVAL hwnd AS DWORD, BYVAL pUnk AS DWORD) AS LONG
 FUNCTION = SendMessage(hwnd, %MCIWNDM_OPENINTERFACE, 0, pUnk)
END FUNCTION
'#define MCIWndSetOwner(hwnd, hwndP) (LONG)MCIWndSM(hwnd, MCIWNDM_SETOWNER, (WPARAM)(hwndP), 0)
FUNCTION MCIWndSetOwner (BYVAL hwnd AS DWORD, BYVAL hwndP AS DWORD) AS LONG
 FUNCTION = SendMessage(hwnd, %MCIWNDM_SETOWNER, hwndP, 0)
END FUNCTION
#ENDIF ' /* NOMCIWND */ ----------------------------------------------------------------
'/****************************************************************************
' *
' * VIDEO - Video Capture Driver Interface
' *
' ****************************************************************************/
'#if !defined(NOAVICAP) || !defined(NOVIDEO)
#IF NOT %DEF(%NOAVICAP) ' ----------------------------------------------------------------
#IF NOT %DEF(%NOVIDEO) ' ----------------------------------------------------------------
'#ifndef _RCINVOKED
'/* video data types */
'DECLARE_HANDLE(HVIDEO); // generic handle
'typedef HVIDEO FAR * LPHVIDEO;
'#endif // ifndef RCINVOKED
'/****************************************************************************
' version api
'****************************************************************************/
'DWORD FAR PASCAL VideoForWindowsVersion(void);
'/****************************************************************************
' Error Return Values
'****************************************************************************/
%EQUATE `DV_ERR_OK = (0) ' /* No error */
%EQUATE `DV_ERR_BASE = (1) ' /* Error Base */
%EQUATE `DV_ERR_NONSPECIFIC = (%DV_ERR_BASE)
%EQUATE `DV_ERR_BADFORMAT = (%DV_ERR_BASE + 1) ' /* unsupported video format */
%EQUATE `DV_ERR_STILLPLAYING = (%DV_ERR_BASE + 2) ' /* still something playing */
%EQUATE `DV_ERR_UNPREPARED = (%DV_ERR_BASE + 3) ' /* header not prepared */
%EQUATE `DV_ERR_SYNC = (%DV_ERR_BASE + 4) ' /* device is synchronous */
%EQUATE `DV_ERR_TOOMANYCHANNELS = (%DV_ERR_BASE + 5) ' /* number of channels exceeded */
%EQUATE `DV_ERR_NOTDETECTED = (%DV_ERR_BASE + 6) ' /* HW not detected */
%EQUATE `DV_ERR_BADINSTALL = (%DV_ERR_BASE + 7) ' /* Can not get Profile */
%EQUATE `DV_ERR_CREATEPALETTE = (%DV_ERR_BASE + 8)
%EQUATE `DV_ERR_SIZEFIELD = (%DV_ERR_BASE + 9)
%EQUATE `DV_ERR_PARAM1 = (%DV_ERR_BASE + 10)
%EQUATE `DV_ERR_PARAM2 = (%DV_ERR_BASE + 11)
%EQUATE `DV_ERR_CONFIG1 = (%DV_ERR_BASE + 12)
%EQUATE `DV_ERR_CONFIG2 = (%DV_ERR_BASE + 13)
%EQUATE `DV_ERR_FLAGS = (%DV_ERR_BASE + 14)
%EQUATE `DV_ERR_13 = (%DV_ERR_BASE + 15)
%EQUATE `DV_ERR_NOTSUPPORTED = (%DV_ERR_BASE + 16) ' /* function not suported */
%EQUATE `DV_ERR_NOMEM = (%DV_ERR_BASE + 17) ' /* out of memory */
%EQUATE `DV_ERR_ALLOCATED = (%DV_ERR_BASE + 18) ' /* device is allocated */
%EQUATE `DV_ERR_BADDEVICEID = (%DV_ERR_BASE + 19)
%EQUATE `DV_ERR_INVALHANDLE = (%DV_ERR_BASE + 20)
%EQUATE `DV_ERR_BADERRNUM = (%DV_ERR_BASE + 21)
%EQUATE `DV_ERR_NO_BUFFERS = (%DV_ERR_BASE + 22) ' /* out of buffers */
%EQUATE `DV_ERR_MEM_CONFLICT = (%DV_ERR_BASE + 23) ' /* Mem conflict detected */
%EQUATE `DV_ERR_IO_CONFLICT = (%DV_ERR_BASE + 24) ' /* I/O conflict detected */
%EQUATE `DV_ERR_DMA_CONFLICT = (%DV_ERR_BASE + 25) ' /* DMA conflict detected */
%EQUATE `DV_ERR_INT_CONFLICT = (%DV_ERR_BASE + 26) ' /* Interrupt conflict detected */
%EQUATE `DV_ERR_PROTECT_ONLY = (%DV_ERR_BASE + 27) ' /* Can not run in standard mode */
%EQUATE `DV_ERR_LASTERROR = (%DV_ERR_BASE + 27)
' //%DV_IDS_PROFILING = (%DV_ERR_BASE + 900)
' //%DV_IDS_LISTBOX = (%DV_ERR_BASE + 901)
%EQUATE `DV_ERR_USER_MSG = (%DV_ERR_BASE + 1000) ' /* Hardware specific errors */
'/****************************************************************************
' Callback Messages
'Note that the values for all installable driver callback messages are
'identical, (ie. MM_DRVM_DATA has the same value for capture drivers,
'installable video codecs, and the audio compression manager).
'****************************************************************************/
'#ifndef _RCINVOKED
%EQUATE `MM_DRVM_OPEN = &H3D0
%EQUATE `MM_DRVM_CLOSE = &H3D1
%EQUATE `MM_DRVM_DATA = &H3D2
%EQUATE `MM_DRVM_ERROR = &H3D3
'#endif
%EQUATE `DV_VM_OPEN = %MM_DRVM_OPEN ' // Obsolete messages
%EQUATE `DV_VM_CLOSE = %MM_DRVM_CLOSE
%EQUATE `DV_VM_DATA = %MM_DRVM_DATA
%EQUATE `DV_VM_ERROR = %MM_DRVM_ERROR
'/****************************************************************************
' Structures
'****************************************************************************/
'/* video data block header */
' // Size = 40 bytes
TYPE VIDEOHDR DWORD
 lpData AS BYTE PTR ' LPBYTE /* pointer to locked data buffer */
 dwBufferLength AS DWORD ' DWORD /* Length of data buffer */
 dwBytesUsed AS DWORD ' DWORD /* Bytes actually used */
 dwTimeCaptured AS DWORD ' DWORD /* Milliseconds from start of stream */
 dwUser AS DWORD ' DWORD_PTR /* for client's use */
 dwFlags AS DWORD ' DWORD /* assorted flags (see defines) */
 dwReserved(3) AS DWORD ' DWORD_PTR[4] /* reserved for driver */
END TYPE
'/* dwFlags field of VIDEOHDR */
%EQUATE `VHDR_DONE = &H00000001 ' /* Done bit */
%EQUATE `VHDR_PREPARED = &H00000002 ' /* Set if this header has been prepared */
%EQUATE `VHDR_INQUEUE = &H00000004 ' /* Reserved for driver */
%EQUATE `VHDR_KEYFRAME = &H00000008 ' /* Key Frame */
%EQUATE `VHDR_VALID = &H0000000F ' /* valid flags */ ' /* ;Internal */
'/* Channel capabilities structure */
' // Size = 36 bytes
TYPE CHANNEL_CAPS DWORD
 dwFlags AS DWORD ' DWORD /* Capability flags*/
 dwSrcRectXMod AS DWORD ' DWORD /* Granularity of src rect in x */
 dwSrcRectYMod AS DWORD ' DWORD /* Granularity of src rect in y */
 dwSrcRectWidthMod AS DWORD ' DWORD /* Granularity of src rect width */
 dwSrcRectHeightMod AS DWORD ' DWORD /* Granularity of src rect height */
 dwDstRectXMod AS DWORD ' DWORD /* Granularity of dst rect in x */
 dwDstRectYMod AS DWORD ' DWORD /* Granularity of dst rect in y */
 dwDstRectWidthMod AS DWORD ' DWORD /* Granularity of dst rect width */
 dwDstRectHeightMod AS DWORD ' DWORD /* Granularity of dst rect height */
END TYPE
'/* dwFlags of CHANNEL_CAPS */
%EQUATE `VCAPS_OVERLAY = &H00000001 ' /* overlay channel */
%EQUATE `VCAPS_SRC_CAN_CLIP = &H00000002 ' /* src rect can clip */
%EQUATE `VCAPS_DST_CAN_CLIP = &H00000004 ' /* dst rect can clip */
%EQUATE `VCAPS_CAN_SCALE = &H00000008 ' /* allows src != dst */
'/****************************************************************************
' API Flags
'****************************************************************************/
'// Types of channels to open with the videoOpen function
%EQUATE `VIDEO_EXTERNALIN = &H0001
%EQUATE `VIDEO_EXTERNALOUT = &H0002
%EQUATE `VIDEO_IN = &H0004
%EQUATE `VIDEO_OUT = &H0008
'// Is a driver dialog available for this channel?
%EQUATE `VIDEO_DLG_QUERY = &H0010
'// videoConfigure (both GET and SET)
%EQUATE `VIDEO_CONFIGURE_QUERY = &H8000
'// videoConfigure (SET only)
%EQUATE `VIDEO_CONFIGURE_SET = &H1000
'// videoConfigure (GET only)
%EQUATE `VIDEO_CONFIGURE_GET = &H2000
%EQUATE `VIDEO_CONFIGURE_QUERYSIZE = &H0001
%EQUATE `VIDEO_CONFIGURE_CURRENT = &H0010
%EQUATE `VIDEO_CONFIGURE_NOMINAL = &H0020
%EQUATE `VIDEO_CONFIGURE_MIN = &H0040
%EQUATE `VIDEO_CONFIGURE_MAX = &H0080
'/****************************************************************************
' CONFIGURE MESSAGES
'****************************************************************************/
%EQUATE `DVM_USER = &H4000
%EQUATE `DVM_CONFIGURE_START = &H1000
%EQUATE `DVM_CONFIGURE_END = &H1FFF
%EQUATE `DVM_PALETTE = (%DVM_CONFIGURE_START + 1)
%EQUATE `DVM_FORMAT = (%DVM_CONFIGURE_START + 2)
%EQUATE `DVM_PALETTERGB555 = (%DVM_CONFIGURE_START + 3)
%EQUATE `DVM_SRC_RECT = (%DVM_CONFIGURE_START + 4)
%EQUATE `DVM_DST_RECT = (%DVM_CONFIGURE_START + 5)
'#endif /* ifndef _RCINVOKED */
'#endif /* NOVIDEO */
#ENDIF ' /* NOVIDEO */ ' ----------------------------------------------------------------
#ENDIF ' /* NOAVICAP */ ' ----------------------------------------------------------------
'/****************************************************************************
' *
' * AVICAP - Window class for AVI capture
' *
' ***************************************************************************/
'#ifndef NOAVICAP
'#ifdef __cplusplus
'/* SendMessage in C++*/
'#define AVICapSM(hwnd,m,w,l) ( (::IsWindow(hwnd)) ? ::SendMessage(hwnd,m,w,l) : 0)
'#else
'/* SendMessage in C */
'#define AVICapSM(hwnd,m,w,l) ( (IsWindow(hwnd)) ? SendMessage(hwnd,m,w,l) : 0)
'#endif /* __cplusplus */
'#ifndef RC_INVOKED
'// ------------------------------------------------------------------
'// Window Messages WM_CAP... which can be sent to an AVICAP window
'// ------------------------------------------------------------------
'// UNICODE
'//
'// The Win32 version of AVICAP on NT supports UNICODE applications:
'// for each API or message that takes a char or string parameter, there are
'// two versions, ApiNameA and ApiNameW. The default name ApiName is #defined
'// to one or other depending on whether UNICODE is defined. Apps can call
'// the A and W apis directly, and mix them.
'//
'// The 32-bit AVICAP on NT uses unicode exclusively internally.
'// ApiNameA() will be implemented as a call to ApiNameW() together with
'// translation of strings.
'// Defines start of the message range
%EQUATE `WM_CAP_START = %WM_USER
'// start of unicode messages
%EQUATE `WM_CAP_UNICODE_START = %WM_USER + 100
%EQUATE `WM_CAP_GET_CAPSTREAMPTR = %WM_CAP_START + 1
'#define WM_CAP_SET_CALLBACK_ERRORW (WM_CAP_UNICODE_START+ 2)
'#define WM_CAP_SET_CALLBACK_STATUSW (WM_CAP_UNICODE_START+ 3)
'#define WM_CAP_SET_CALLBACK_ERRORA (WM_CAP_START+ 2)
'#define WM_CAP_SET_CALLBACK_STATUSA (WM_CAP_START+ 3)
'#ifdef UNICODE
'#define WM_CAP_SET_CALLBACK_ERROR WM_CAP_SET_CALLBACK_ERRORW
'#define WM_CAP_SET_CALLBACK_STATUS WM_CAP_SET_CALLBACK_STATUSW
'#else
'#define WM_CAP_SET_CALLBACK_ERROR WM_CAP_SET_CALLBACK_ERRORA
'#define WM_CAP_SET_CALLBACK_STATUS WM_CAP_SET_CALLBACK_STATUSA
'#endif
%EQUATE `WM_CAP_SET_CALLBACK_ERRORW = %WM_CAP_UNICODE_START + 2
%EQUATE `WM_CAP_SET_CALLBACK_STATUSW = %WM_CAP_UNICODE_START + 3
%EQUATE `WM_CAP_SET_CALLBACK_ERRORA = %WM_CAP_START + 2
%EQUATE `WM_CAP_SET_CALLBACK_STATUSA = %WM_CAP_START + 3
%EQUATE `WM_CAP_SET_CALLBACK_ERROR = %WM_CAP_START + 2
%EQUATE `WM_CAP_SET_CALLBACK_STATUS = %WM_CAP_START + 3
%EQUATE `WM_CAP_SET_CALLBACK_YIELD = %WM_CAP_START + 4
%EQUATE `WM_CAP_SET_CALLBACK_FRAME = %WM_CAP_START + 5
%EQUATE `WM_CAP_SET_CALLBACK_VIDEOSTREAM = %WM_CAP_START + 6
%EQUATE `WM_CAP_SET_CALLBACK_WAVESTREAM = %WM_CAP_START + 7
%EQUATE `WM_CAP_GET_USER_DATA = %WM_CAP_START + 8
%EQUATE `WM_CAP_SET_USER_DATA = %WM_CAP_START + 9
%EQUATE `WM_CAP_DRIVER_CONNECT = %WM_CAP_START + 10
%EQUATE `WM_CAP_DRIVER_DISCONNECT = %WM_CAP_START + 11
'#define WM_CAP_DRIVER_GET_NAMEA (WM_CAP_START+ 12)
'#define WM_CAP_DRIVER_GET_VERSIONA (WM_CAP_START+ 13)
'#define WM_CAP_DRIVER_GET_NAMEW (WM_CAP_UNICODE_START+ 12)
'#define WM_CAP_DRIVER_GET_VERSIONW (WM_CAP_UNICODE_START+ 13)
'#ifdef UNICODE
'#define WM_CAP_DRIVER_GET_NAME WM_CAP_DRIVER_GET_NAMEW
'#define WM_CAP_DRIVER_GET_VERSION WM_CAP_DRIVER_GET_VERSIONW
'#else
'#define WM_CAP_DRIVER_GET_NAME WM_CAP_DRIVER_GET_NAMEA
'#define WM_CAP_DRIVER_GET_VERSION WM_CAP_DRIVER_GET_VERSIONA
'#endif
%EQUATE `WM_CAP_DRIVER_GET_NAMEA = %WM_CAP_START + 12
%EQUATE `WM_CAP_DRIVER_GET_VERSIONA = %WM_CAP_START + 13
%EQUATE `WM_CAP_DRIVER_GET_NAMEW = %WM_CAP_UNICODE_START + 12
%EQUATE `WM_CAP_DRIVER_GET_VERSIONW = %WM_CAP_UNICODE_START + 13
%EQUATE `WM_CAP_DRIVER_GET_NAME = %WM_CAP_DRIVER_GET_NAMEA
%EQUATE `WM_CAP_DRIVER_GET_VERSION = %WM_CAP_DRIVER_GET_VERSIONA
%EQUATE `WM_CAP_DRIVER_GET_CAPS = %WM_CAP_START + 14
'#define WM_CAP_FILE_SET_CAPTURE_FILEA (WM_CAP_START+ 20)
'#define WM_CAP_FILE_GET_CAPTURE_FILEA (WM_CAP_START+ 21)
'#define WM_CAP_FILE_SAVEASA (WM_CAP_START+ 23)
'#define WM_CAP_FILE_SAVEDIBA (WM_CAP_START+ 25)
'#define WM_CAP_FILE_SET_CAPTURE_FILEW (WM_CAP_UNICODE_START+ 20)
'#define WM_CAP_FILE_GET_CAPTURE_FILEW (WM_CAP_UNICODE_START+ 21)
'#define WM_CAP_FILE_SAVEASW (WM_CAP_UNICODE_START+ 23)
'#define WM_CAP_FILE_SAVEDIBW (WM_CAP_UNICODE_START+ 25)
'#ifdef UNICODE
'#define WM_CAP_FILE_SET_CAPTURE_FILE WM_CAP_FILE_SET_CAPTURE_FILEW
'#define WM_CAP_FILE_GET_CAPTURE_FILE WM_CAP_FILE_GET_CAPTURE_FILEW
'#define WM_CAP_FILE_SAVEAS WM_CAP_FILE_SAVEASW
'#define WM_CAP_FILE_SAVEDIB WM_CAP_FILE_SAVEDIBW
'#else
'#define WM_CAP_FILE_SET_CAPTURE_FILE WM_CAP_FILE_SET_CAPTURE_FILEA
'#define WM_CAP_FILE_GET_CAPTURE_FILE WM_CAP_FILE_GET_CAPTURE_FILEA
'#define WM_CAP_FILE_SAVEAS WM_CAP_FILE_SAVEASA
'#define WM_CAP_FILE_SAVEDIB WM_CAP_FILE_SAVEDIBA
'#endif
%EQUATE `WM_CAP_FILE_SET_CAPTURE_FILEA = %WM_CAP_START + 20
%EQUATE `WM_CAP_FILE_GET_CAPTURE_FILEA = %WM_CAP_START + 21
%EQUATE `WM_CAP_FILE_SAVEASA = %WM_CAP_START + 23
%EQUATE `WM_CAP_FILE_SAVEDIBA = %WM_CAP_START + 25
%EQUATE `WM_CAP_FILE_SET_CAPTURE_FILEW = %WM_CAP_UNICODE_START + 20
%EQUATE `WM_CAP_FILE_GET_CAPTURE_FILEW = %WM_CAP_UNICODE_START + 21
%EQUATE `WM_CAP_FILE_SAVEASW = %WM_CAP_UNICODE_START + 23
%EQUATE `WM_CAP_FILE_SAVEDIBW = %WM_CAP_UNICODE_START + 25
%EQUATE `WM_CAP_FILE_SET_CAPTURE_FILE = %WM_CAP_FILE_SET_CAPTURE_FILEA
%EQUATE `WM_CAP_FILE_GET_CAPTURE_FILE = %WM_CAP_FILE_GET_CAPTURE_FILEA
%EQUATE `WM_CAP_FILE_SAVEAS = %WM_CAP_FILE_SAVEASA
%EQUATE `WM_CAP_FILE_SAVEDIB = %WM_CAP_FILE_SAVEDIBA
'// out of order to save on ifdefs
%EQUATE `WM_CAP_FILE_ALLOCATE = %WM_CAP_START + 22
%EQUATE `WM_CAP_FILE_SET_INFOCHUNK = %WM_CAP_START + 24
%EQUATE `WM_CAP_EDIT_COPY = %WM_CAP_START + 30
%EQUATE `WM_CAP_SET_AUDIOFORMAT = %WM_CAP_START + 35
%EQUATE `WM_CAP_GET_AUDIOFORMAT = %WM_CAP_START + 36
%EQUATE `WM_CAP_DLG_VIDEOFORMAT = %WM_CAP_START + 41
%EQUATE `WM_CAP_DLG_VIDEOSOURCE = %WM_CAP_START + 42
%EQUATE `WM_CAP_DLG_VIDEODISPLAY = %WM_CAP_START + 43
%EQUATE `WM_CAP_GET_VIDEOFORMAT = %WM_CAP_START + 44
%EQUATE `WM_CAP_SET_VIDEOFORMAT = %WM_CAP_START + 45
%EQUATE `WM_CAP_DLG_VIDEOCOMPRESSION = %WM_CAP_START + 46
%EQUATE `WM_CAP_SET_PREVIEW = %WM_CAP_START + 50
%EQUATE `WM_CAP_SET_OVERLAY = %WM_CAP_START + 51
%EQUATE `WM_CAP_SET_PREVIEWRATE = %WM_CAP_START + 52
%EQUATE `WM_CAP_SET_SCALE = %WM_CAP_START + 53
%EQUATE `WM_CAP_GET_STATUS = %WM_CAP_START + 54
%EQUATE `WM_CAP_SET_SCROLL = %WM_CAP_START + 55
%EQUATE `WM_CAP_GRAB_FRAME = %WM_CAP_START + 60
%EQUATE `WM_CAP_GRAB_FRAME_NOSTOP = %WM_CAP_START + 61
%EQUATE `WM_CAP_SEQUENCE = %WM_CAP_START + 62
%EQUATE `WM_CAP_SEQUENCE_NOFILE = %WM_CAP_START + 63
%EQUATE `WM_CAP_SET_SEQUENCE_SETUP = %WM_CAP_START + 64
%EQUATE `WM_CAP_GET_SEQUENCE_SETUP = %WM_CAP_START + 65
'#define WM_CAP_SET_MCI_DEVICEA (WM_CAP_START+ 66)
'#define WM_CAP_GET_MCI_DEVICEA (WM_CAP_START+ 67)
'#define WM_CAP_SET_MCI_DEVICEW (WM_CAP_UNICODE_START+ 66)
'#define WM_CAP_GET_MCI_DEVICEW (WM_CAP_UNICODE_START+ 67)
'#ifdef UNICODE
'#define WM_CAP_SET_MCI_DEVICE WM_CAP_SET_MCI_DEVICEW
'#define WM_CAP_GET_MCI_DEVICE WM_CAP_GET_MCI_DEVICEW
'#else
'#define WM_CAP_SET_MCI_DEVICE WM_CAP_SET_MCI_DEVICEA
'#define WM_CAP_GET_MCI_DEVICE WM_CAP_GET_MCI_DEVICEA
'#endif
%EQUATE `WM_CAP_SET_MCI_DEVICEA = %WM_CAP_START + 66
%EQUATE `WM_CAP_GET_MCI_DEVICEA = %WM_CAP_START + 67
%EQUATE `WM_CAP_SET_MCI_DEVICEW = %WM_CAP_UNICODE_START + 66
%EQUATE `WM_CAP_GET_MCI_DEVICEW = %WM_CAP_UNICODE_START + 67
%EQUATE `WM_CAP_SET_MCI_DEVICE = %WM_CAP_SET_MCI_DEVICEA
%EQUATE `WM_CAP_GET_MCI_DEVICE = %WM_CAP_GET_MCI_DEVICEA
%EQUATE `WM_CAP_STOP = %WM_CAP_START + 68
%EQUATE `WM_CAP_ABORT = %WM_CAP_START + 69
%EQUATE `WM_CAP_SINGLE_FRAME_OPEN = %WM_CAP_START + 70
%EQUATE `WM_CAP_SINGLE_FRAME_CLOSE = %WM_CAP_START + 71
%EQUATE `WM_CAP_SINGLE_FRAME = %WM_CAP_START + 72
'#define WM_CAP_PAL_OPENA (WM_CAP_START+ 80)
'#define WM_CAP_PAL_SAVEA (WM_CAP_START+ 81)
'#define WM_CAP_PAL_OPENW (WM_CAP_UNICODE_START+ 80)
'#define WM_CAP_PAL_SAVEW (WM_CAP_UNICODE_START+ 81)
'#ifdef UNICODE
'#define WM_CAP_PAL_OPEN WM_CAP_PAL_OPENW
'#define WM_CAP_PAL_SAVE WM_CAP_PAL_SAVEW
'#else
'#define WM_CAP_PAL_OPEN WM_CAP_PAL_OPENA
'#define WM_CAP_PAL_SAVE WM_CAP_PAL_SAVEA
'#endif
%EQUATE `WM_CAP_PAL_OPENA = %WM_CAP_START + 80
%EQUATE `WM_CAP_PAL_SAVEA = %WM_CAP_START + 81
%EQUATE `WM_CAP_PAL_OPENW = %WM_CAP_UNICODE_START + 80
%EQUATE `WM_CAP_PAL_SAVEW = %WM_CAP_UNICODE_START + 81
%EQUATE `WM_CAP_PAL_OPEN = %WM_CAP_PAL_OPENA
%EQUATE `WM_CAP_PAL_SAVE = %WM_CAP_PAL_SAVEA
%EQUATE `WM_CAP_PAL_PASTE = %WM_CAP_START + 82
%EQUATE `WM_CAP_PAL_AUTOCREATE = %WM_CAP_START + 83
%EQUATE `WM_CAP_PAL_MANUALCREATE = %WM_CAP_START + 84
'// Following added post VFW 1.1
%EQUATE `WM_CAP_SET_CALLBACK_CAPCONTROL = %WM_CAP_START + 85
'// Defines end of the message range
%EQUATE `WM_CAP_UNICODE_END = %WM_CAP_PAL_SAVEW
%EQUATE `WM_CAP_END = %WM_CAP_UNICODE_END
'// ------------------------------------------------------------------
'// Structures
'// ------------------------------------------------------------------
' // Size = 44 bytes
TYPE CAPDRIVERCAPS DWORD
 wDeviceIndex AS DWORD ' UINT // Driver index in system.ini
 fHasOverlay AS LONG ' BOOL // Can device overlay?
 fHasDlgVideoSource AS LONG ' BOOL // Has Video source dlg?
 fHasDlgVideoFormat AS LONG ' BOOL // Has Format dlg?
 fHasDlgVideoDisplay AS LONG ' BOOL // Has External out dlg?
 fCaptureInitialized AS LONG ' BOOL // Driver ready to capture?
 fDriverSuppliesPalettes AS LONG ' BOOL // Can driver make palettes?
 ' // following always NULL on Win32.
 hVideoIn AS DWORD ' HANDLE // Driver In channel
 hVideoOut AS DWORD ' HANDLE // Driver Out channel
 hVideoExtIn AS DWORD ' HANDLE // Driver Ext In channel
 hVideoExtOut AS DWORD ' HANDLE // Driver Ext Out channel
END TYPE
' // Size = 76 bytes
TYPE CAPSTATUS DWORD
 uiImageWidth AS DWORD ' UINT // Width of the image
 uiImageHeight AS DWORD ' UINT // Height of the image
 fLiveWindow AS LONG ' BOOL // Now Previewing video?
 fOverlayWindow AS LONG ' BOOL // Now Overlaying video?
 fScale AS LONG ' BOOL // Scale image to client?
 ptScroll AS POINT ' POINT // Scroll position
 fUsingDefaultPalette AS LONG ' BOOL // Using default driver palette?
 fAudioHardware AS LONG ' BOOL // Audio hardware present?
 fCapFileExists AS LONG ' BOOL // Does capture file exist?
 dwCurrentVideoFrame AS DWORD ' DWORD // # of video frames cap'td
 dwCurrentVideoFramesDropped AS DWORD ' DWORD // # of video frames dropped
 dwCurrentWaveSamples AS DWORD ' DWORD // # of wave samples cap'td
 dwCurrentTimeElapsedMS AS DWORD ' DWORD // Elapsed capture duration
 hPalCurrent AS DWORD ' HPALETTE // Current palette in use
 fCapturingNow AS LONG ' BOOL // Capture in progress?
 dwReturn AS DWORD ' DWORD // Error value after any operation
 wNumVideoAllocated AS DWORD ' UINT // Actual number of video buffers
 wNumAudioAllocated AS DWORD ' UINT // Actual number of audio buffers
END TYPE
' // Size = 96 bytes
TYPE CAPTUREPARMS DWORD
 dwRequestMicroSecPerFrame AS DWORD ' DWORD // Requested capture rate
 fMakeUserHitOKToCapture AS LONG ' BOOL // Show "Hit OK to cap" dlg?
 wPercentDropForError AS DWORD ' UINT // Give error msg if > (10%)
 fYield AS LONG ' BOOL // Capture via background task?
 dwIndexSize AS DWORD ' DWORD // Max index size in frames (32K)
 wChunkGranularity AS DWORD ' UINT // Junk chunk granularity (2K)
 fUsingDOSMemory AS LONG ' BOOL // Use DOS buffers?
 wNumVideoRequested AS DWORD ' UINT // # video buffers, If 0, autocalc
 fCaptureAudio AS LONG ' BOOL // Capture audio?
 wNumAudioRequested AS DWORD ' UINT // # audio buffers, If 0, autocalc
 vKeyAbort AS DWORD ' UINT // Virtual key causing abort
 fAbortLeftMouse AS LONG ' BOOL // Abort on left mouse?
 fAbortRightMouse AS LONG ' BOOL // Abort on right mouse?
 fLimitEnabled AS LONG ' BOOL // Use wTimeLimit?
 wTimeLimit AS DWORD ' UINT // Seconds to capture
 fMCIControl AS LONG ' BOOL // Use MCI video source?
 fStepMCIDevice AS LONG ' BOOL // Step MCI device?
 dwMCIStartTime AS DWORD ' DWORD // Time to start in MS
 dwMCIStopTime AS DWORD ' DWORD // Time to stop in MS
 fStepCaptureAt2x AS LONG ' BOOL // Perform spatial averaging 2x
 wStepCaptureAverageFrames AS DWORD ' UINT // Temporal average n Frames
 dwAudioBufferSize AS DWORD ' DWORD // Size of audio bufs (0 = default)
 fDisableWriteCache AS LONG ' BOOL // Attempt to disable write cache
 AVStreamMaster AS DWORD ' UINT // Which stream controls length?
END TYPE
'// ------------------------------------------------------------------
'// AVStreamMaster
'// Since Audio and Video streams generally use non-synchronized capture
'// clocks, this flag determines whether the audio stream is to be considered
'// the master or controlling clock when writing the AVI file:
'//
'// AVSTREAMMASTER_AUDIO - Audio is master, video frame duration is forced
'// to match audio duration (VFW 1.0, 1.1 default)
'// AVSTREAMMASTER_NONE - No master, audio and video streams may be of
'// different lengths
'// ------------------------------------------------------------------
%EQUATE `AVSTREAMMASTER_AUDIO = 0 ' /* Audio master (VFW 1.0, 1.1) */
%EQUATE `AVSTREAMMASTER_NONE = 1 ' /* No master */
' // Size = 12 bytes
TYPE CAPINFOCHUNK DWORD
 fccInfoID AS DWORD ' // Chunk ID, "ICOP" for copyright
 lpData AS DWORD ' // pointer to data
 cbData AS LONG ' // size of lpData
END TYPE
'// ------------------------------------------------------------------
'// Message crackers for above
'// ------------------------------------------------------------------
'// message wrapper macros are defined for the default messages only. Apps
'// that wish to mix Ansi and UNICODE message sending will have to
'// reference the _A and _W messages directly
'#define capSetCallbackOnError(hwnd, fpProc) ((BOOL)AVICapSM(hwnd, WM_CAP_SET_CALLBACK_ERROR, 0, (LPARAM)(LPVOID)(fpProc)))
FUNCTION capSetCallbackOnError (BYVAL hwnd AS DWORD, BYVAL fpProc AS DWORD) AS LONG
 FUNCTION = SendMessage(hwnd, %WM_CAP_SET_CALLBACK_ERROR, 0, fpProc)
END FUNCTION
'#define capSetCallbackOnStatus(hwnd, fpProc) ((BOOL)AVICapSM(hwnd, WM_CAP_SET_CALLBACK_STATUS, 0, (LPARAM)(LPVOID)(fpProc)))
FUNCTION capSetCallbackOnStatus (BYVAL hwnd AS DWORD, BYVAL fpProc AS DWORD) AS LONG
 FUNCTION = SendMessage(hwnd, %WM_CAP_SET_CALLBACK_STATUS, 0, fpProc)
END FUNCTION
'#define capSetCallbackOnYield(hwnd, fpProc) ((BOOL)AVICapSM(hwnd, WM_CAP_SET_CALLBACK_YIELD, 0, (LPARAM)(LPVOID)(fpProc)))
FUNCTION capSetCallbackOnYield (BYVAL hwnd AS DWORD, BYVAL fpProc AS DWORD) AS LONG
 FUNCTION = SendMessage(hwnd, %WM_CAP_SET_CALLBACK_YIELD, 0, fpProc)
END FUNCTION
'#define capSetCallbackOnFrame(hwnd, fpProc) ((BOOL)AVICapSM(hwnd, WM_CAP_SET_CALLBACK_FRAME, 0, (LPARAM)(LPVOID)(fpProc)))
FUNCTION capSetCallbackOnFrame (BYVAL hwnd AS DWORD, BYVAL fpProc AS DWORD) AS LONG
 FUNCTION = SendMessage(hwnd, %WM_CAP_SET_CALLBACK_FRAME, 0, fpProc)
END FUNCTION
'#define capSetCallbackOnVideoStream(hwnd, fpProc) ((BOOL)AVICapSM(hwnd, WM_CAP_SET_CALLBACK_VIDEOSTREAM, 0, (LPARAM)(LPVOID)(fpProc)))
FUNCTION capSetCallbackOnVideoStream (BYVAL hwnd AS DWORD, BYVAL fpProc AS DWORD) AS LONG
 FUNCTION = SendMessage(hwnd, %WM_CAP_SET_CALLBACK_VIDEOSTREAM, 0, fpProc)
END FUNCTION
'#define capSetCallbackOnWaveStream(hwnd, fpProc) ((BOOL)AVICapSM(hwnd, WM_CAP_SET_CALLBACK_WAVESTREAM, 0, (LPARAM)(LPVOID)(fpProc)))
FUNCTION capSetCallbackOnWaveStream (BYVAL hwnd AS DWORD, BYVAL fpProc AS DWORD) AS LONG
 FUNCTION = SendMessage(hwnd, %WM_CAP_SET_CALLBACK_WAVESTREAM, 0, fpProc)
END FUNCTION
'#define capSetCallbackOnCapControl(hwnd, fpProc) ((BOOL)AVICapSM(hwnd, WM_CAP_SET_CALLBACK_CAPCONTROL, 0, (LPARAM)(LPVOID)(fpProc)))
FUNCTION capSetCallbackOnCapControl (BYVAL hwnd AS DWORD, BYVAL fpProc AS DWORD) AS LONG
 FUNCTION = SendMessage(hwnd, %WM_CAP_SET_CALLBACK_CAPCONTROL, 0, fpProc)
END FUNCTION
'#define capSetUserData(hwnd, lUser) ((BOOL)AVICapSM(hwnd, WM_CAP_SET_USER_DATA, 0, (LPARAM)lUser))
FUNCTION capSetUserData (BYVAL hwnd AS DWORD, BYVAL lUser AS LONG) AS LONG
 FUNCTION = SendMessage(hwnd, %WM_CAP_SET_USER_DATA, 0, lUser)
END FUNCTION
'#define capGetUserData(hwnd) (AVICapSM(hwnd, WM_CAP_GET_USER_DATA, 0, 0))
FUNCTION capGetUserData (BYVAL hwnd AS DWORD) AS LONG
 FUNCTION = SendMessage(hwnd, %WM_CAP_GET_USER_DATA, 0, 0)
END FUNCTION
'#define capDriverConnect(hwnd, i) ((BOOL)AVICapSM(hwnd, WM_CAP_DRIVER_CONNECT, (WPARAM)(i), 0L))
FUNCTION capDriverConnect (BYVAL hwnd AS DWORD, BYVAL i AS LONG) AS LONG
 FUNCTION = SendMessage(hwnd, %WM_CAP_SET_USER_DATA, i, 0)
END FUNCTION
'#define capDriverDisconnect(hwnd) ((BOOL)AVICapSM(hwnd, WM_CAP_DRIVER_DISCONNECT, (WPARAM)0, 0L))
FUNCTION capDriverDisconnect (BYVAL hwnd AS DWORD) AS LONG
 FUNCTION = SendMessage(hwnd, %WM_CAP_DRIVER_DISCONNECT, 0, 0)
END FUNCTION
'#define capDriverGetName(hwnd, szName, wSize) ((BOOL)AVICapSM(hwnd, WM_CAP_DRIVER_GET_NAME, (WPARAM)(wSize), (LPARAM)(LPVOID)(LPTSTR)(szName)))
FUNCTION capDriverGetName (BYVAL hwnd AS DWORD, BYREF szName AS ASCIIZ, BYVAL wSize AS WORD) AS LONG
 FUNCTION = SendMessage(hwnd, %WM_CAP_DRIVER_GET_NAME, wSize, VARPTR(szName))
END FUNCTION
'#define capDriverGetVersion(hwnd, szVer, wSize) ((BOOL)AVICapSM(hwnd, WM_CAP_DRIVER_GET_VERSION, (WPARAM)(wSize), (LPARAM)(LPVOID)(LPTSTR)(szVer)))
FUNCTION capDriverGetVersion (BYVAL hwnd AS DWORD, BYREF szVer AS ASCIIZ, BYVAL wSize AS WORD) AS LONG
 FUNCTION = SendMessage(hwnd, %WM_CAP_DRIVER_GET_VERSION, wSize, VARPTR(szVer))
END FUNCTION
'#define capDriverGetCaps(hwnd, s, wSize) ((BOOL)AVICapSM(hwnd, WM_CAP_DRIVER_GET_CAPS, (WPARAM)(wSize), (LPARAM)(LPVOID)(LPCAPDRIVERCAPS)(s)))
FUNCTION capDriverGetCaps (BYVAL hwnd AS DWORD, BYREF s AS CAPDRIVERCAPS, BYVAL wSize AS WORD) AS LONG
 FUNCTION = SendMessage(hwnd, %WM_CAP_DRIVER_GET_VERSION, wSize, VARPTR(s))
END FUNCTION
'#define capFileSetCaptureFile(hwnd, szName) ((BOOL)AVICapSM(hwnd, WM_CAP_FILE_SET_CAPTURE_FILE, 0, (LPARAM)(LPVOID)(LPTSTR)(szName)))
FUNCTION capFileSetCaptureFile (BYVAL hwnd AS DWORD, BYREF szName AS ASCIIZ) AS LONG
 FUNCTION = SendMessage(hwnd, %WM_CAP_FILE_SET_CAPTURE_FILE, 0, VARPTR(szName))
END FUNCTION
'#define capFileGetCaptureFile(hwnd, szName, wSize) ((BOOL)AVICapSM(hwnd, WM_CAP_FILE_GET_CAPTURE_FILE, (WPARAM)(wSize), (LPARAM)(LPVOID)(LPTSTR)(szName)))
FUNCTION capFileGetCaptureFile (BYVAL hwnd AS DWORD, BYREF szName AS ASCIIZ, BYVAL wSize AS WORD) AS LONG
 FUNCTION = SendMessage(hwnd, %WM_CAP_FILE_GET_CAPTURE_FILE, wSize, VARPTR(szName))
END FUNCTION
'#define capFileAlloc(hwnd, dwSize) ((BOOL)AVICapSM(hwnd, WM_CAP_FILE_ALLOCATE, 0, (LPARAM)(DWORD)(dwSize)))
FUNCTION capFileAlloc (BYVAL hwnd AS DWORD, BYVAL dwSize AS DWORD) AS LONG
 FUNCTION = SendMessage(hwnd, %WM_CAP_FILE_ALLOCATE, 0, dwSize)
END FUNCTION
'#define capFileSaveAs(hwnd, szName) ((BOOL)AVICapSM(hwnd, WM_CAP_FILE_SAVEAS, 0, (LPARAM)(LPVOID)(LPTSTR)(szName)))
FUNCTION capFileSaveAs (BYVAL hwnd AS DWORD, BYREF szName AS ASCIIZ) AS LONG
 FUNCTION = SendMessage(hwnd, %WM_CAP_FILE_SAVEAS, 0, VARPTR(szName))
END FUNCTION
'#define capFileSetInfoChunk(hwnd, lpInfoChunk) ((BOOL)AVICapSM(hwnd, WM_CAP_FILE_SET_INFOCHUNK, (WPARAM)0, (LPARAM)(LPCAPINFOCHUNK)(lpInfoChunk)))
FUNCTION capFileSetInfoChunk (BYVAL hwnd AS DWORD, BYREF lpInfoChunk AS CAPINFOCHUNK) AS LONG
 FUNCTION = SendMessage(hwnd, %WM_CAP_FILE_SET_INFOCHUNK, 0, VARPTR(lpInfoChunk))
END FUNCTION
'#define capFileSaveDIB(hwnd, szName) ((BOOL)AVICapSM(hwnd, WM_CAP_FILE_SAVEDIB, 0, (LPARAM)(LPVOID)(LPTSTR)(szName)))
FUNCTION capFileSaveDIB (BYVAL hwnd AS DWORD, BYREF szName AS ASCIIZ) AS LONG
 FUNCTION = SendMessage(hwnd, %WM_CAP_FILE_SAVEDIB, 0, VARPTR(szName))
END FUNCTION
'#define capEditCopy(hwnd) ((BOOL)AVICapSM(hwnd, WM_CAP_EDIT_COPY, 0, 0L))
FUNCTION capEditCopy (BYVAL hwnd AS DWORD) AS LONG
 FUNCTION = SendMessage(hwnd, %WM_CAP_EDIT_COPY, 0, 0)
END FUNCTION
'#define capSetAudioFormat(hwnd, s, wSize) ((BOOL)AVICapSM(hwnd, WM_CAP_SET_AUDIOFORMAT, (WPARAM)(wSize), (LPARAM)(LPVOID)(LPWAVEFORMATEX)(s)))
FUNCTION capSetAudioFormat (BYVAL hwnd AS DWORD, BYREF s AS WAVEFORMATEX, wSize AS WORD) AS LONG
 FUNCTION = SendMessage(hwnd, %WM_CAP_SET_AUDIOFORMAT, wSize, VARPTR(s))
END FUNCTION
'#define capGetAudioFormat(hwnd, s, wSize) ((DWORD)AVICapSM(hwnd, WM_CAP_GET_AUDIOFORMAT, (WPARAM)(wSize), (LPARAM)(LPVOID)(LPWAVEFORMATEX)(s)))
FUNCTION capGetAudioFormat (BYVAL hwnd AS DWORD, BYREF s AS WAVEFORMATEX, wSize AS WORD) AS LONG
 FUNCTION = SendMessage(hwnd, %WM_CAP_GET_AUDIOFORMAT, wSize, VARPTR(s))
END FUNCTION
'#define capGetAudioFormatSize(hwnd) ((DWORD)AVICapSM(hwnd, WM_CAP_GET_AUDIOFORMAT, (WPARAM)0, (LPARAM)0L))
FUNCTION capGetAudioFormatSize (BYVAL hwnd AS DWORD) AS LONG
 FUNCTION = SendMessage(hwnd, %WM_CAP_GET_AUDIOFORMAT, 0, 0)
END FUNCTION
'#define capDlgVideoFormat(hwnd) ((BOOL)AVICapSM(hwnd, WM_CAP_DLG_VIDEOFORMAT, 0, 0L))
FUNCTION capDlgVideoFormat (BYVAL hwnd AS DWORD) AS LONG
 FUNCTION = SendMessage(hwnd, %WM_CAP_DLG_VIDEOFORMAT, 0, 0)
END FUNCTION
'#define capDlgVideoSource(hwnd) ((BOOL)AVICapSM(hwnd, WM_CAP_DLG_VIDEOSOURCE, 0, 0L))
FUNCTION capDlgVideoSource (BYVAL hwnd AS DWORD) AS LONG
 FUNCTION = SendMessage(hwnd, %WM_CAP_DLG_VIDEOSOURCE, 0, 0)
END FUNCTION
'#define capDlgVideoDisplay(hwnd) ((BOOL)AVICapSM(hwnd, WM_CAP_DLG_VIDEODISPLAY, 0, 0L))
FUNCTION capDlgVideoDisplay (BYVAL hwnd AS DWORD) AS LONG
 FUNCTION = SendMessage(hwnd, %WM_CAP_DLG_VIDEODISPLAY, 0, 0)
END FUNCTION
'#define capDlgVideoCompression(hwnd) ((BOOL)AVICapSM(hwnd, WM_CAP_DLG_VIDEOCOMPRESSION, 0, 0L))
FUNCTION capDlgVideoCompression (BYVAL hwnd AS DWORD) AS LONG
 FUNCTION = SendMessage(hwnd, %WM_CAP_DLG_VIDEOCOMPRESSION, 0, 0)
END FUNCTION
'#define capGetVideoFormat(hwnd, s, wSize) ((DWORD)AVICapSM(hwnd, WM_CAP_GET_VIDEOFORMAT, (WPARAM)(wSize), (LPARAM)(LPVOID)(s)))
FUNCTION capGetVideoFormat (BYVAL hwnd AS DWORD, BYVAL s AS DWORD, wSize AS WORD) AS LONG
 FUNCTION = SendMessage(hwnd, %WM_CAP_GET_VIDEOFORMAT, wSize, s)
END FUNCTION
'#define capGetVideoFormatSize(hwnd) ((DWORD)AVICapSM(hwnd, WM_CAP_GET_VIDEOFORMAT, 0, 0L))
FUNCTION capGetVideoFormatSize (BYVAL hwnd AS DWORD) AS LONG
 FUNCTION = SendMessage(hwnd, %WM_CAP_GET_VIDEOFORMAT, 0, 0)
END FUNCTION
'#define capSetVideoFormat(hwnd, s, wSize) ((BOOL)AVICapSM(hwnd, WM_CAP_SET_VIDEOFORMAT, (WPARAM)(wSize), (LPARAM)(LPVOID)(s)))
FUNCTION capSetVideoFormat (BYVAL hwnd AS DWORD, s AS DWORD, wSize AS WORD) AS LONG
 FUNCTION = SendMessage(hwnd, %WM_CAP_SET_VIDEOFORMAT, wSize, s)
END FUNCTION
'#define capPreview(hwnd, f) ((BOOL)AVICapSM(hwnd, WM_CAP_SET_PREVIEW, (WPARAM)(BOOL)(f), 0L))
FUNCTION capPreview (BYVAL hwnd AS DWORD, BYVAL f AS LONG) AS LONG
 FUNCTION = SendMessage(hwnd, %WM_CAP_SET_PREVIEW, f, 0)
END FUNCTION
'#define capPreviewRate(hwnd, wMS) ((BOOL)AVICapSM(hwnd, WM_CAP_SET_PREVIEWRATE, (WPARAM)(wMS), 0))
FUNCTION capPreviewRate (BYVAL hwnd AS DWORD, BYVAL wMS AS WORD) AS LONG
 FUNCTION = SendMessage(hwnd, %WM_CAP_SET_PREVIEWRATE, wMS, 0)
END FUNCTION
'#define capOverlay(hwnd, f) ((BOOL)AVICapSM(hwnd, WM_CAP_SET_OVERLAY, (WPARAM)(BOOL)(f), 0L))
FUNCTION capOverlay (BYVAL hwnd AS DWORD, BYVAL f AS LONG) AS LONG
 FUNCTION = SendMessage(hwnd, %WM_CAP_SET_OVERLAY, f, 0)
END FUNCTION
'#define capPreviewScale(hwnd, f) ((BOOL)AVICapSM(hwnd, WM_CAP_SET_SCALE, (WPARAM)(BOOL)f, 0L))
FUNCTION capPreviewScale (BYVAL hwnd AS DWORD, BYVAL f AS LONG) AS LONG
 FUNCTION = SendMessage(hwnd, %WM_CAP_SET_SCALE, f, 0)
END FUNCTION
'#define capGetStatus(hwnd, s, wSize) ((BOOL)AVICapSM(hwnd, WM_CAP_GET_STATUS, (WPARAM)(wSize), (LPARAM)(LPVOID)(LPCAPSTATUS)(s)))
FUNCTION capGetStatus (BYVAL hwnd AS DWORD, BYREF s AS CAPSTATUS, wSize AS WORD) AS LONG
 FUNCTION = SendMessage(hwnd, %WM_CAP_GET_STATUS, wSize, VARPTR(s))
END FUNCTION
'#define capSetScrollPos(hwnd, lpP) ((BOOL)AVICapSM(hwnd, WM_CAP_SET_SCROLL, (WPARAM)0, (LPARAM)(LPPOINT)(lpP)))
FUNCTION capSetScrollPos (BYVAL hwnd AS DWORD, BYREF lpP AS POINT) AS LONG
 FUNCTION = SendMessage(hwnd, %WM_CAP_SET_SCROLL, 0, VARPTR(lpP))
END FUNCTION
'#define capGrabFrame(hwnd) ((BOOL)AVICapSM(hwnd, WM_CAP_GRAB_FRAME, (WPARAM)0, (LPARAM)0L))
FUNCTION capGrabFrame (BYVAL hwnd AS DWORD) AS LONG
 FUNCTION = SendMessage(hwnd, %WM_CAP_GRAB_FRAME, 0, 0)
END FUNCTION
'#define capGrabFrameNoStop(hwnd) ((BOOL)AVICapSM(hwnd, WM_CAP_GRAB_FRAME_NOSTOP, (WPARAM)0, (LPARAM)0L))
FUNCTION capGrabFrameNoStop (BYVAL hwnd AS DWORD) AS LONG
 FUNCTION = SendMessage(hwnd, %WM_CAP_GRAB_FRAME_NOSTOP, 0, 0)
END FUNCTION
'#define capCaptureSequence(hwnd) ((BOOL)AVICapSM(hwnd, WM_CAP_SEQUENCE, (WPARAM)0, (LPARAM)0L))
FUNCTION capCaptureSequence (BYVAL hwnd AS DWORD) AS LONG
 FUNCTION = SendMessage(hwnd, %WM_CAP_SEQUENCE, 0, 0)
END FUNCTION
'#define capCaptureSequenceNoFile(hwnd) ((BOOL)AVICapSM(hwnd, WM_CAP_SEQUENCE_NOFILE, (WPARAM)0, (LPARAM)0L))
FUNCTION capCaptureSequenceNoFile (BYVAL hwnd AS DWORD) AS LONG
 FUNCTION = SendMessage(hwnd, %WM_CAP_SEQUENCE_NOFILE, 0, 0)
END FUNCTION
'#define capCaptureStop(hwnd) ((BOOL)AVICapSM(hwnd, WM_CAP_STOP, (WPARAM)0, (LPARAM)0L))
FUNCTION capCaptureStop (BYVAL hwnd AS DWORD) AS LONG
 FUNCTION = SendMessage(hwnd, %WM_CAP_STOP, 0, 0)
END FUNCTION
'#define capCaptureAbort(hwnd) ((BOOL)AVICapSM(hwnd, WM_CAP_ABORT, (WPARAM)0, (LPARAM)0L))
FUNCTION capCaptureAbort (BYVAL hwnd AS DWORD) AS LONG
 FUNCTION = SendMessage(hwnd, %WM_CAP_ABORT, 0, 0)
END FUNCTION
'#define capCaptureSingleFrameOpen(hwnd) ((BOOL)AVICapSM(hwnd, WM_CAP_SINGLE_FRAME_OPEN, (WPARAM)0, (LPARAM)0L))
FUNCTION capCaptureSingleFrameOpen (BYVAL hwnd AS DWORD) AS LONG
 FUNCTION = SendMessage(hwnd, %WM_CAP_SINGLE_FRAME_OPEN, 0, 0)
END FUNCTION
'#define capCaptureSingleFrameClose(hwnd) ((BOOL)AVICapSM(hwnd, WM_CAP_SINGLE_FRAME_CLOSE, (WPARAM)0, (LPARAM)0L))
FUNCTION capCaptureSingleFrameClose (BYVAL hwnd AS DWORD) AS LONG
 FUNCTION = SendMessage(hwnd, %WM_CAP_SINGLE_FRAME_CLOSE, 0, 0)
END FUNCTION
'#define capCaptureSingleFrame(hwnd) ((BOOL)AVICapSM(hwnd, WM_CAP_SINGLE_FRAME, (WPARAM)0, (LPARAM)0L))
FUNCTION capCaptureSingleFrame (BYVAL hwnd AS DWORD) AS LONG
 FUNCTION = SendMessage(hwnd, %WM_CAP_SINGLE_FRAME, 0, 0)
END FUNCTION
'#define capCaptureGetSetup(hwnd, s, wSize) ((BOOL)AVICapSM(hwnd, WM_CAP_GET_SEQUENCE_SETUP, (WPARAM)(wSize), (LPARAM)(LPVOID)(LPCAPTUREPARMS)(s)))
FUNCTION capCaptureGetSetup (BYVAL hwnd AS DWORD, BYREF s AS CAPTUREPARMS, BYVAL wSize AS WORD) AS LONG
 FUNCTION = SendMessage(hwnd, %WM_CAP_GET_SEQUENCE_SETUP, wSize, VARPTR(s))
END FUNCTION
'#define capCaptureSetSetup(hwnd, s, wSize) ((BOOL)AVICapSM(hwnd, WM_CAP_SET_SEQUENCE_SETUP, (WPARAM)(wSize), (LPARAM)(LPVOID)(LPCAPTUREPARMS)(s)))
FUNCTION capCaptureSetSetup (BYVAL hwnd AS DWORD, BYREF s AS CAPTUREPARMS, BYVAL wSize AS WORD) AS LONG
 FUNCTION = SendMessage(hwnd, %WM_CAP_SET_SEQUENCE_SETUP, wSize, VARPTR(s))
END FUNCTION
'#define capSetMCIDeviceName(hwnd, szName) ((BOOL)AVICapSM(hwnd, WM_CAP_SET_MCI_DEVICE, 0, (LPARAM)(LPVOID)(LPTSTR)(szName)))
FUNCTION capSetMCIDeviceName (BYVAL hwnd AS DWORD, BYREF szName AS ASCIIZ) AS LONG
 FUNCTION = SendMessage(hwnd, %WM_CAP_SET_MCI_DEVICE, 0, VARPTR(szName))
END FUNCTION
'#define capGetMCIDeviceName(hwnd, szName, wSize) ((BOOL)AVICapSM(hwnd, WM_CAP_GET_MCI_DEVICE, (WPARAM)(wSize), (LPARAM)(LPVOID)(LPTSTR)(szName)))
FUNCTION capGetMCIDeviceName (BYVAL hwnd AS DWORD, BYREF szName AS ASCIIZ, BYVAL wSize AS WORD) AS LONG
 FUNCTION = SendMessage(hwnd, %WM_CAP_SET_MCI_DEVICE, wSize, VARPTR(szName))
END FUNCTION
'#define capPaletteOpen(hwnd, szName) ((BOOL)AVICapSM(hwnd, WM_CAP_PAL_OPEN, 0, (LPARAM)(LPVOID)(LPTSTR)(szName)))
FUNCTION capPaletteOpen (BYVAL hwnd AS DWORD, BYREF szName AS ASCIIZ) AS LONG
 FUNCTION = SendMessage(hwnd, %WM_CAP_PAL_OPEN, 0, VARPTR(szName))
END FUNCTION
'#define capPaletteSave(hwnd, szName) ((BOOL)AVICapSM(hwnd, WM_CAP_PAL_SAVE, 0, (LPARAM)(LPVOID)(LPTSTR)(szName)))
FUNCTION capPaletteSave (BYVAL hwnd AS DWORD, BYREF szName AS ASCIIZ) AS LONG
 FUNCTION = SendMessage(hwnd, %WM_CAP_PAL_SAVE, 0, VARPTR(szName))
END FUNCTION
'#define capPalettePaste(hwnd) ((BOOL)AVICapSM(hwnd, WM_CAP_PAL_PASTE, (WPARAM) 0, (LPARAM)0L))
FUNCTION capPalettePaste (BYVAL hwnd AS DWORD) AS LONG
 FUNCTION = SendMessage(hwnd, %WM_CAP_PAL_PASTE, 0, 0)
END FUNCTION
'#define capPaletteAuto(hwnd, iFrames, iColors) ((BOOL)AVICapSM(hwnd, WM_CAP_PAL_AUTOCREATE, (WPARAM)(iFrames), (LPARAM)(DWORD)(iColors)))
FUNCTION capPaletteAuto (BYVAL hwnd AS DWORD, BYVAL iFrames AS LONG, BYVAL iColors AS LONG) AS LONG
 FUNCTION = SendMessage(hwnd, %WM_CAP_PAL_AUTOCREATE, iFrames, iColors)
END FUNCTION
'#define capPaletteManual(hwnd, fGrab, iColors) ((BOOL)AVICapSM(hwnd, WM_CAP_PAL_MANUALCREATE, (WPARAM)(fGrab), (LPARAM)(DWORD)(iColors)))
FUNCTION capPaletteManual (BYVAL hwnd AS DWORD, BYVAL fGrab AS LONG, BYVAL iColors AS LONG) AS LONG
 FUNCTION = SendMessage(hwnd, %WM_CAP_PAL_MANUALCREATE, fGrab, iColors)
END FUNCTION
'// ------------------------------------------------------------------
'// Callback Definitions
'// ------------------------------------------------------------------
'typedef LRESULT (CALLBACK* CAPYIELDCALLBACK) (HWND hWnd);
'typedef LRESULT (CALLBACK* CAPSTATUSCALLBACKW) (HWND hWnd, int nID, LPCWSTR lpsz);
'typedef LRESULT (CALLBACK* CAPERRORCALLBACKW) (HWND hWnd, int nID, LPCWSTR lpsz);
'typedef LRESULT (CALLBACK* CAPSTATUSCALLBACKA) (HWND hWnd, int nID, LPCSTR lpsz);
'typedef LRESULT (CALLBACK* CAPERRORCALLBACKA) (HWND hWnd, int nID, LPCSTR lpsz);
'#ifdef UNICODE
'#define CAPSTATUSCALLBACK CAPSTATUSCALLBACKW
'#define CAPERRORCALLBACK CAPERRORCALLBACKW
'#else
'#define CAPSTATUSCALLBACK CAPSTATUSCALLBACKA
'#define CAPERRORCALLBACK CAPERRORCALLBACKA
'#endif
'typedef LRESULT (CALLBACK* CAPVIDEOCALLBACK) (HWND hWnd, LPVIDEOHDR lpVHdr);
'typedef LRESULT (CALLBACK* CAPWAVECALLBACK) (HWND hWnd, LPWAVEHDR lpWHdr);
'typedef LRESULT (CALLBACK* CAPCONTROLCALLBACK)(HWND hWnd, int nState);
'FUNCTION CAPYIELDCALLBACK (BYVAL hwnd AS DWORD) AS LONG
'FUNCTION CAPSTATUSCALLBACKW (BYVAL hwnd AS DWORD, BYVAL nID AS LONG, BYVAL lpsz AS DWORD) AS LONG
'FUNCTION CAPERRORCALLBACKW (BYVAL hwnd AS DWORD, BYVAL nID AS LONG, BYVAL lpsz AS DWORD) AS LONG
'FUNCTION CAPSTATUSCALLBACKA (BYVAL hwnd AS DWORD, BYVAL nID AS LONG, BYREF lpsz AS ASCIIZ) AS LONG
'FUNCTION CAPERRORCALLBACKA (BYVAL hwnd AS DWORD, BYVAL nID AS LONG, BYREF lpsz AS ASCIIZ) AS LONG
'FUNCTION CAPVIDEOCALLBACK (BYVAL hwnd AS DWORD, BYREF lpVHdr AS VIDEOHDR) AS LONG
'FUNCTION CAPWAVECALLBACK (BYVAL hwnd AS DWORD, BYREF lpWHdr AS WAVEHDR) AS LONG
'FUNCTION CAPCONTROLCALLBACK (BYVAL hwnd AS DWORD, BYVAL nState AS LONG) AS LONG
'// ------------------------------------------------------------------
'// CapControlCallback states
'// ------------------------------------------------------------------
%EQUATE `CONTROLCALLBACK_PREROLL = 1 ' /* Waiting to start capture */
%EQUATE `CONTROLCALLBACK_CAPTURING = 2 ' /* Now capturing */
'// ------------------------------------------------------------------
'// The only exported functions from AVICAP.DLL
'// ------------------------------------------------------------------
DECLARE FUNCTION capCreateCaptureWindowA LIB "avicap32.dll" ALIAS "capCreateCaptureWindowA" ( BYREF lpszWindowName AS ASCIIZ , BYVAL dwStyle AS QUAD , BYVAL x AS LONG , BYVAL y AS LONG , BYVAL nWidth AS LONG , BYVAL nHeight AS LONG , BYVAL hwndParent AS QUAD , BYVAL nID AS LONG ) AS QUAD
DECLARE FUNCTION capCreateCaptureWindowW LIB "avicap32.dll" ALIAS "capCreateCaptureWindowW" ( BYREF lpszWindowName AS WSTRINGZ
 , BYVAL dwStyle AS DWORD
 , BYVAL x AS LONG
 , BYVAL y AS LONG
 , BYVAL nWidth AS LONG
 , BYVAL nHeight AS LONG
 , BYVAL hwndParent AS DWORD
 , BYVAL nID AS LONG
 ) AS DWORD
#IF %DEF(%UNICODE)
 MACRO capCreateCaptureWindow = capCreateCaptureWindowW
#ELSE
 MACRO capCreateCaptureWindow = capCreateCaptureWindowA
#ENDIF
DECLARE FUNCTION capGetDriverDescriptionA LIB "avicap32.dll" ALIAS "capGetDriverDescriptionA" ( BYVAL wDriverIndex AS QUAD , BYREF lpszName AS ASCIIZ , BYVAL cbName AS LONG , BYREF lpszVer AS ASCIIZ , BYVAL cbVer AS LONG ) AS LONG
DECLARE FUNCTION capGetDriverDescriptionW LIB "avicap32.dll" ALIAS "capGetDriverDescriptionW" ( BYVAL wDriverIndex AS QUAD
 , BYREF lpszName AS WSTRINGZ
 , BYVAL cbName AS LONG
 , BYREF lpszVer AS WSTRINGZ
 , BYVAL cbVer AS LONG
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO capGetDriverDescription = capGetDriverDescriptionW
#ELSE
 MACRO capGetDriverDescription = capGetDriverDescriptionA
#ENDIF
'// ------------------------------------------------------------------
'// New Information chunk IDs
'// ------------------------------------------------------------------
'#define infotypeDIGITIZATION_TIME mmioFOURCC ('I','D','I','T')
'#define infotypeSMPTE_TIME mmioFOURCC ('I','S','M','P')
%EQUATE `infotypeDIGITIZATION_TIME = &H54494449
%EQUATE `infotypeSMPTE_TIME = &H504D5349
'// ------------------------------------------------------------------
'// String IDs from status and error callbacks
'// ------------------------------------------------------------------
%EQUATE `IDS_CAP_BEGIN = 300 ' /* "Capture Start" */
%EQUATE `IDS_CAP_END = 301 ' /* "Capture End" */
%EQUATE `IDS_CAP_INFO = 401 ' /* "%s" */
%EQUATE `IDS_CAP_OUTOFMEM = 402 ' /* "Out of memory" */
%EQUATE `IDS_CAP_FILEEXISTS = 403 ' /* "File '%s' exists -- overwrite it?" */
%EQUATE `IDS_CAP_ERRORPALOPEN = 404 ' /* "Error opening palette '%s'" */
%EQUATE `IDS_CAP_ERRORPALSAVE = 405 ' /* "Error saving palette '%s'" */
%EQUATE `IDS_CAP_ERRORDIBSAVE = 406 ' /* "Error saving frame '%s'" */
%EQUATE `IDS_CAP_DEFAVIEXT = 407 ' /* "avi" */
%EQUATE `IDS_CAP_DEFPALEXT = 408 ' /* "pal" */
%EQUATE `IDS_CAP_CANTOPEN = 409 ' /* "Cannot open '%s'" */
%EQUATE `IDS_CAP_SEQ_MSGSTART = 410 ' /* "Select OK to start capture\nof video sequence\nto %s." */
%EQUATE `IDS_CAP_SEQ_MSGSTOP = 411 ' /* "Hit ESCAPE or click to end capture" */
%EQUATE `IDS_CAP_VIDEDITERR = 412 ' /* "An error occurred while trying to run VidEdit." */
%EQUATE `IDS_CAP_READONLYFILE = 413 ' /* "The file '%s' is a read-only file." */
%EQUATE `IDS_CAP_WRITEERROR = 414 ' /* "Unable to write to file '%s'.\nDisk may be full." */
%EQUATE `IDS_CAP_NODISKSPACE = 415 ' /* "There is no space to create a capture file on the specified device." */
%EQUATE `IDS_CAP_SETFILESIZE = 416 ' /* "Set File Size" */
%EQUATE `IDS_CAP_SAVEASPERCENT = 417 ' /* "SaveAs: %2ld%% Hit Escape to abort." */
%EQUATE `IDS_CAP_DRIVER_ERROR = 418 ' /* Driver specific error message */
%EQUATE `IDS_CAP_WAVE_OPEN_ERROR = 419 ' /* "Error: Cannot open the wave input device.\nCheck sample size, frequency, and channels." */
%EQUATE `IDS_CAP_WAVE_ALLOC_ERROR = 420 ' /* "Error: Out of memory for wave buffers." */
%EQUATE `IDS_CAP_WAVE_PREPARE_ERROR = 421 ' /* "Error: Cannot prepare wave buffers." */
%EQUATE `IDS_CAP_WAVE_ADD_ERROR = 422 ' /* "Error: Cannot add wave buffers." */
%EQUATE `IDS_CAP_WAVE_SIZE_ERROR = 423 ' /* "Error: Bad wave size." */
%EQUATE `IDS_CAP_VIDEO_OPEN_ERROR = 424 ' /* "Error: Cannot open the video input device." */
%EQUATE `IDS_CAP_VIDEO_ALLOC_ERROR = 425 ' /* "Error: Out of memory for video buffers." */
%EQUATE `IDS_CAP_VIDEO_PREPARE_ERROR = 426 ' /* "Error: Cannot prepare video buffers." */
%EQUATE `IDS_CAP_VIDEO_ADD_ERROR = 427 ' /* "Error: Cannot add video buffers." */
%EQUATE `IDS_CAP_VIDEO_SIZE_ERROR = 428 ' /* "Error: Bad video size." */
%EQUATE `IDS_CAP_FILE_OPEN_ERROR = 429 ' /* "Error: Cannot open capture file." */
%EQUATE `IDS_CAP_FILE_WRITE_ERROR = 430 ' /* "Error: Cannot write to capture file. Disk may be full." */
%EQUATE `IDS_CAP_RECORDING_ERROR = 431 ' /* "Error: Cannot write to capture file. Data rate too high or disk full." */
%EQUATE `IDS_CAP_RECORDING_ERROR2 = 432 ' /* "Error while recording" */
%EQUATE `IDS_CAP_AVI_INIT_ERROR = 433 ' /* "Error: Unable to initialize for capture." */
%EQUATE `IDS_CAP_NO_FRAME_CAP_ERROR = 434 ' /* "Warning: No frames captured.\nConfirm that vertical sync interrupts\nare configured and enabled." */
%EQUATE `IDS_CAP_NO_PALETTE_WARN = 435 ' /* "Warning: Using default palette." */
%EQUATE `IDS_CAP_MCI_CONTROL_ERROR = 436 ' /* "Error: Unable to access MCI device." */
%EQUATE `IDS_CAP_MCI_CANT_STEP_ERROR = 437 ' /* "Error: Unable to step MCI device." */
%EQUATE `IDS_CAP_NO_AUDIO_CAP_ERROR = 438 ' /* "Error: No audio data captured.\nCheck audio card settings." */
%EQUATE `IDS_CAP_AVI_DRAWDIB_ERROR = 439 ' /* "Error: Unable to draw this data format." */
%EQUATE `IDS_CAP_COMPRESSOR_ERROR = 440 ' /* "Error: Unable to initialize compressor." */
%EQUATE `IDS_CAP_AUDIO_DROP_ERROR = 441 ' /* "Error: Audio data was lost during capture, reduce capture rate." */
%EQUATE `IDS_CAP_AUDIO_DROP_COMPERROR = 442 ' /* "Error: Audio data was lost during capture. Try capturing without compressing." */
'/* status string IDs */
%EQUATE `IDS_CAP_STAT_LIVE_MODE = 500 ' /* "Live window" */
%EQUATE `IDS_CAP_STAT_OVERLAY_MODE = 501 ' /* "Overlay window" */
%EQUATE `IDS_CAP_STAT_CAP_INIT = 502 ' /* "Setting up for capture - Please wait" */
%EQUATE `IDS_CAP_STAT_CAP_FINI = 503 ' /* "Finished capture, now writing frame %ld" */
%EQUATE `IDS_CAP_STAT_PALETTE_BUILD = 504 ' /* "Building palette map" */
%EQUATE `IDS_CAP_STAT_OPTPAL_BUILD = 505 ' /* "Computing optimal palette" */
%EQUATE `IDS_CAP_STAT_I_FRAMES = 506 ' /* "%d frames" */
%EQUATE `IDS_CAP_STAT_L_FRAMES = 507 ' /* "%ld frames" */
%EQUATE `IDS_CAP_STAT_CAP_L_FRAMES = 508 ' /* "Captured %ld frames" */
%EQUATE `IDS_CAP_STAT_CAP_AUDIO = 509 ' /* "Capturing audio" */
%EQUATE `IDS_CAP_STAT_VIDEOCURRENT = 510 ' /* "Captured %ld frames (%ld dropped) %d.%03d sec." */
%EQUATE `IDS_CAP_STAT_VIDEOAUDIO = 511 ' /* "Captured %d.%03d sec. %ld frames (%ld dropped) (%d.%03d fps). %ld audio bytes (%d,%03d sps)" */
%EQUATE `IDS_CAP_STAT_VIDEOONLY = 512 ' /* "Captured %d.%03d sec. %ld frames (%ld dropped) (%d.%03d fps)" */
%EQUATE `IDS_CAP_STAT_FRAMESDROPPED = 513 ' /* "Dropped %ld of %ld frames (%d.%02d%%) during capture." */
#ENDIF ' /* NOAVICAP */ ' ----------------------------------------------------------------
'/****************************************************************************
' *
' * ACM (Audio compression manager)
' *
' ***************************************************************************/
#IF NOT %DEF(%NOMSACM)
 #INCLUDE ONCE "Legacy/System/MSAcm.inc"
#ENDIF
'/****************************************************************************
' *
' * FilePreview dialog.
' *
' ***************************************************************************/
'#ifdef OFN_READONLY
#IF NOT %DEF(%COMDLG_INC)
 #INCLUDE ONCE "Legacy/COM/CommDlg.inc" ' for OPENFILENAME structure
#ENDIF
DECLARE FUNCTION GetOpenFileNamePreviewA LIB "msvfw32.dll" ALIAS "GetOpenFileNamePreviewA" ( BYREF lpofn AS OPENFILENAMEA ) AS LONG
DECLARE FUNCTION GetOpenFileNamePreviewW LIB "msvfw32.dll" ALIAS "GetOpenFileNamePreviewW" ( BYREF lpofn AS OPENFILENAMEW
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO GetOpenFileNamePreview = GetOpenFileNamePreviewW
#ELSE
 MACRO GetOpenFileNamePreview = GetOpenFileNamePreviewA
#ENDIF
DECLARE FUNCTION GetSaveFileNamePreviewA LIB "msvfw32.dll" ALIAS "GetSaveFileNamePreviewA" ( BYREF lpofn AS OPENFILENAMEA ) AS LONG
DECLARE FUNCTION GetSaveFileNamePreviewW LIB "msvfw32.dll" ALIAS "GetSaveFileNamePreviewW" ( BYREF lpofn AS OPENFILENAMEW
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO GetSaveFileNamePreview = GetSaveFileNamePreviewW
#ELSE
 MACRO GetSaveFileNamePreview = GetSaveFileNamePreviewA
#ENDIF
'#endif // OFN_READONLY
#ENDIF
