当前位置:主页>销售管理软件> 列表

200分求AVICAP32.PAS 找金蝶进销存软件

进销存软件版1楼: 100分求AVICAP32.PAS

2楼: {
****************************************************************************
* *
* Translated from avicap.h *
* *
* Main include file. *
* *
* Microsoft Video for Windows Sample Capture Class *
* *
* *
* C/C++ Run Time Library - Version 8.0 *
* *
* Copyright (c) 1994, 1997 by Borland International *
* All Rights Reserved. *


* *
* *
****************************************************************************
}
unit AviCapH;

interface

uses windows,messages;

// ------------------------------------------------------------------
// Window Messages WM_CAP... which can be sent to an AVICAP window
// ------------------------------------------------------------------

// Defines start of the message range
const
avicap32=''avicap32.dll'';

WM_CAP_START= WM_USER;

// start of unicode messages
WM_CAP_UNICODE_START= WM_USER+100;

WM_CAP_GET_CAPSTREAMPTR= (WM_CAP_START+ 1);

WM_CAP_SET_CALLBACK_ERROR= (WM_CAP_START+ 2) ;
WM_CAP_SET_CALLBACK_STATUS= (WM_CAP_START+ 3);

WM_CAP_SET_CALLBACK_YIELD= (WM_CAP_START+ 4);
WM_CAP_SET_CALLBACK_FRAME= (WM_CAP_START+ 5);


WM_CAP_SET_CALLBACK_VIDEOSTREAM= (WM_CAP_START+ 6);
WM_CAP_SET_CALLBACK_WAVESTREAM= (WM_CAP_START+ 7);
WM_CAP_GET_USER_DATA =(WM_CAP_START+ 8);
WM_CAP_SET_USER_DATA =(WM_CAP_START+ 9) ;

WM_CAP_DRIVER_CONNECT =(WM_CAP_START+ 10);
WM_CAP_DRIVER_DISCONNECT =(WM_CAP_START+ 11);

WM_CAP_DRIVER_GET_NAME =(WM_CAP_START+ 12);
WM_CAP_DRIVER_GET_VERSION =(WM_CAP_START+ 13);

WM_CAP_DRIVER_GET_CAPS =(WM_CAP_START+ 14);

WM_CAP_FILE_SET_CAPTURE_FILE =(WM_CAP_START+ 20);
WM_CAP_FILE_GET_CAPTURE_FILE =(WM_CAP_START+ 21);
WM_CAP_FILE_SAVEAS =(WM_CAP_START+ 23);
WM_CAP_FILE_SAVEDIB =(WM_CAP_START+ 25);

// out of order to save on ifdefs
WM_CAP_FILE_ALLOCATE =(WM_CAP_START+ 22);
WM_CAP_FILE_SET_INFOCHUNK =(WM_CAP_START+ 24);

WM_CAP_EDIT_COPY =(WM_CAP_START+ 30);

WM_CAP_SET_AUDIOFORMAT =(WM_CAP_START+ 35);
WM_CAP_GET_AUDIOFORMAT =(WM_CAP_START+ 36);

WM_CAP_DLG_VIDEOFORMAT =(WM_CAP_START+ 41);
WM_CAP_DLG_VIDEOSOURCE =(WM_CAP_START+ 42);
WM_CAP_DLG_VIDEODISPLAY =(WM_CAP_START+ 43);
WM_CAP_GET_VIDEOFORMAT =(WM_CAP_START+ 44);
WM_CAP_SET_VIDEOFORMAT =(WM_CAP_START+ 45);
WM_CAP_DLG_VIDEOCOMPRESSION =(WM_CAP_START+ 46);

WM_CAP_SET_PREVIEW =(WM_CAP_START+ 50);
WM_CAP_SET_OVERLAY =(WM_CAP_START+ 51);
WM_CAP_SET_PREVIEWRATE =(WM_CAP_START+ 52);
WM_CAP_SET_SCALE =(WM_CAP_START+ 53);
WM_CAP_GET_STATUS =(WM_CAP_START+ 54);
WM_CAP_SET_SCROLL =(WM_CAP_START+ 55);

WM_CAP_GRAB_FRAME =(WM_CAP_START+ 60);
WM_CAP_GRAB_FRAME_NOSTOP =(WM_CAP_START+ 61);

WM_CAP_SEQUENCE =(WM_CAP_START+ 62);
WM_CAP_SEQUENCE_NOFILE =(WM_CAP_START+ 63);
WM_CAP_SET_SEQUENCE_SETUP =(WM_CAP_START+ 64);
WM_CAP_GET_SEQUENCE_SETUP =(WM_CAP_START+ 65);

WM_CAP_SET_MCI_DEVICE =(WM_CAP_START+ 66);
WM_CAP_GET_MCI_DEVICE =(WM_CAP_START+ 67);

WM_CAP_STOP =(WM_CAP_START+ 68);
WM_CAP_ABORT =(WM_CAP_START+ 69);

WM_CAP_SINGLE_FRAME_OPEN =(WM_CAP_START+ 70);
WM_CAP_SINGLE_FRAME_CLOSE =(WM_CAP_START+ 71);
WM_CAP_SINGLE_FRAME =(WM_CAP_START+ 72);

WM_CAP_PAL_OPEN =(WM_CAP_START+ 80);
WM_CAP_PAL_SAVE =(WM_CAP_START+ 81);

WM_CAP_PAL_PASTE =(WM_CAP_START+ 82);
WM_CAP_PAL_AUTOCREATE =(WM_CAP_START+ 83);
WM_CAP_PAL_MANUALCREATE =(WM_CAP_START+ 84);

// Following added post VFW 1.1
WM_CAP_SET_CALLBACK_CAPCONTROL =(WM_CAP_START+ 85);

WM_CAP_END =WM_CAP_SET_CALLBACK_CAPCONTROL;


function capCreateCaptureWindowA (
lpszWindowName:PChar;
dwStyle:DWORD;
x,y,nWidth,nHeight:Integer;
hwndParent:HWnd;nID:Integer):hwnd;stdcall; external avicap32;

function capGetDriverDescriptionA (
wDriverIndex:UINT;
lpszName:PChar;cbName:Integer;
lpszVer:PChar;cbVer:Integer):Boolean;stdcall; external avicap32;

procedure capSetCallbackOnError(hCapWnd:hwnd; fpProc:Lparam);
procedure capSetCallbackOnStatus(hCapWnd:hwnd; fpProc:LParam);
procedure capSetCallbackOnYield(hCapWnd:hwnd; fpProc:LParam);
procedure capSetCallbackOnFrame(hCapWnd:hwnd; fpProc:LParam);
procedure capSetCallbackOnVideoStream(hCapWnd:hwnd; fpProc:LParam);
procedure capSetCallbackOnWaveStream(hCapWnd:hwnd; fpProc:LParam);
procedure capSetCallbackOnCapControl(hCapWnd:hwnd; fpProc:LParam);
procedure capSetUserData(hCapWnd:hwnd;lUser:LParam);
procedure capGetUserData(hCapWnd:hwnd);
function capDriverConnect(hCapWnd:hwnd; i:wParam):Boolean;
procedure capDriverDisconnect(hCapWnd:hwnd);
procedure capDriverGetName(hCapWnd:hwnd; szName:wParam; wSize:LParam);
procedure capDriverGetVersion(hCapWnd:hwnd; szVer:wParam; wSize:LParam);
procedure capDriverGetCaps(hCapWnd:hwnd; s:wParam; wSize:LParam);
procedure capFileSetCaptureFile(hCapWnd:hwnd; szName :LPARAM);
procedure capFileGetCaptureFile(hCapWnd:hwnd; szName :wPARAM; wSize :lPARAM);
procedure capFileAlloc(hCapWnd:hwnd; dwSize :LPARAM);
procedure capFileSaveAs(hCapWnd:hwnd; szName :LPARAM);
procedure capFileSetInfoChunk(hCapWnd:hwnd; lpInfoChunk :LPARAM);
procedure capFileSaveDIB(hCapWnd:hwnd; szName :LPARAM);
procedure capEditCopy(hCapWnd:hwnd);
procedure capSetAudioFormat(hCapWnd:hwnd; s :WPARAM; wSize :LPARAM);
procedure capGetAudioFormat(hCapWnd:hwnd; s :WPARAM; wSize :LPARAM);
procedure capGetAudioFormatSize(hCapWnd:hwnd);
procedure capDlgVideoFormat(hCapWnd:hwnd);
procedure capDlgVideoSource(hCapWnd:hwnd);
procedure capDlgVideoDisplay(hCapWnd:hwnd);
procedure capDlgVideoCompression(hCapWnd:hwnd);
procedure capGetVideoFormat(hCapWnd:hwnd; s:WPARAM; wSize:LPARAM);
procedure capGetVideoFormatSize(hCapWnd:hwnd);
procedure capSetVideoFormat(hCapWnd:hwnd; s:WPARAM; wSize:LPARAM);
procedure capPreview(hCapWnd:hwnd; f :WPARAM);
procedure capPreviewRate(hCapWnd:hwnd; wMS :WPARAM);
procedure capOverlay(hCapWnd:hwnd; f :WPARAM);
procedure capPreviewScale(hCapWnd:hwnd; f :WPARAM);
procedure capGetStatus(hCapWnd:hwnd; s:WPARAM; wSize:LPARAM);
procedure capSetScrollPos(hCapWnd:hwnd; lpP :LPARAM);
procedure capGrabFrame(hCapWnd:hwnd);
procedure capGrabFrameNoStop(hCapWnd:hwnd);
procedure capCaptureSequence(hCapWnd:hwnd);
procedure capCaptureSequenceNoFile(hCapWnd:hwnd);
procedure capCaptureStop(hCapWnd:hwnd);
procedure capCaptureAbort(hCapWnd:hwnd);
procedure capCaptureSingleFrameOpen(hCapWnd:hwnd);
procedure capCaptureSingleFrameClose(hCapWnd:hwnd);
procedure capCaptureSingleFrame(hCapWnd:hwnd);
procedure capCaptureGetSetup(hCapWnd:hwnd; s:WPARAM; wSize:LPARAM);
procedure capCaptureSetSetup(hCapWnd:hwnd; s:WPARAM; wSize:LPARAM);
procedure capSetMCIDeviceName(hCapWnd:hwnd; szName:LPARAM);
procedure capGetMCIDeviceName(hCapWnd:hwnd; szName:LPARAM; wSize:WPARAM);
procedure capPaletteOpen(hCapWnd:hwnd; szName:LPARAM);
procedure capPaletteSave(hCapWnd:hwnd; szName:LPARAM);
procedure capPalettePaste(hCapWnd:hwnd);
procedure capPaletteAuto(hCapWnd:hwnd; iFrames:WPARAM; iColors :LPARAM);
procedure capPaletteManual(hCapWnd:hwnd; fGrab :WPARAM; iColors :LPARAM);


// ------------------------------------------------------------------
// Structures
// ------------------------------------------------------------------

type
TCapDriverCaps =Record
wDeviceIndex:UINT; // Driver index in system.ini
fHasOverlay:BOOL; // Can device overlay?
fHasDlgVideoSource:BOOL; // Has Video source dlg?
fHasDlgVideoFormat:BOOL; // Has Format dlg?
fHasDlgVideoDisplay:BOOL; // Has External out dlg?
fCaptureInitialized:BOOL; // Driver ready to capture?
fDriverSuppliesPalettes:BOOL; // Can driver make palettes?

// following always NULL on Win32.
hVideoIn:THANDLE; // Driver In channel
hVideoOut:THANDLE; // Driver Out channel
hVideoExtIn:THANDLE; // Driver Ext In channel
hVideoExtOut:THANDLE; // Driver Ext Out channel
end;

type
TCapStatus = record
uiImageWidth:UINT ; // Width of the image
uiImageHeight:UINT ; // Height of the image
fLiveWindow:BOOL ; // Now Previewing video?
fOverlayWindow:BOOL ; // Now Overlaying video?
fScale:BOOL ; // Scale image to client?
ptScroll:TPOINT ; // Scroll position
fUsingDefaultPalette:BOOL ; // Using default driver palette?
fAudioHardware:BOOL ; // Audio hardware present?
fCapFileExists:BOOL ; // Does capture file exist?

dwCurrentVideoFrame:DWORD ; // # of video frames cap''td
dwCurrentVideoFramesDropped:DWORD ;// # of video frames dropped
dwCurrentWaveSamples:DWORD ; // # of wave samples cap''td
dwCurrentTimeElapsedMS:DWORD ; // Elapsed capture duration
hPalCurrent:HPALETTE ; // Current palette in use
fCapturingNow:BOOL ; // Capture in progress?
dwReturn:DWORD ; // Error value after any operation
wNumVideoAllocated:UINT ; // Actual number of video buffers
wNumAudioAllocated:UINT ; // Actual number of audio buffers
end;

type
TCaptureParms = Record
dwRequestMicroSecPerFrame:DWORD ; // Requested capture rate
fMakeUserHitOKToCapture:BOOL ; // Show "Hit OK to cap" dlg?
wPercentDropForError:UINT ; // Give error msg if > (10%)
fYield:BOOL ; // Capture via background task?
dwIndexSize:DWORD ; // Max index size in frames (32K)
wChunkGranularity:UINT ; // Junk chunk granularity (2K)
fUsingDOSMemory:BOOL ; // Use DOS buffers?
wNumVideoRequested:UINT ; // # video buffers, If 0, autocalc
fCaptureAudio:BOOL ; // Capture audio?
wNumAudioRequested:UINT ; // # audio buffers, If 0, autocalc
vKeyAbort:UINT ; // Virtual key causing abort
fAbortLeftMouse:BOOL ; // Abort on left mouse?
fAbortRightMouse:BOOL ; // Abort on right mouse?
fLimitEnabled:BOOL ; // Use wTimeLimit?
wTimeLimit:UINT ; // Seconds to capture
fMCIControl:BOOL ; // Use MCI video source?
fStepMCIDevice:BOOL ; // Step MCI device?
dwMCIStartTime:DWORD ; // Time to start in MS
dwMCIStopTime:DWORD ; // Time to stop in MS
fStepCaptureAt2x:BOOL ; // Perform spatial averaging 2x
wStepCaptureAverageFrames:UINT ; // Temporal average n Frames
dwAudioBufferSize:DWORD ; // Size of audio bufs (0 = default)
fDisableWriteCache:BOOL ; // Attempt to disable write cache
AVStreamMaster:DWORD;

end;

type
TByteRec = record
Lo, Hi: Byte;
end;

TWordRec = record
Low, High: TByteRec;
end;

Type
FOURCC=TWordRec;

function mmioFOURCC(const c0,c1,c2,c3:Char):FOURCC;

type
TCapInfoChunk = record
fccInfoID:FOURCC ; // Chunk ID, "ICOP" for copyright
lpData:Pointer ; // pointer to data
cbData:LONGINT ; // size of lpData
end;

// ------------------------------------------------------------------
// CapControlCallback states


// ------------------------------------------------------------------
const
CONTROLCALLBACK_PREROLL = 1; //* Waiting to start capture */
CONTROLCALLBACK_CAPTURING= 2; //* Now capturing */

// ------------------------------------------------------------------
// New Information chunk IDs
// ------------------------------------------------------------------

// DIGITIZATION_TIME = mmioFOURCC (''I'',''D'',''I'',''T'');
// infotypeSMPTE_TIME mmioFOURCC (''I'',''S'',''M'',''P'')

// ------------------------------------------------------------------
// String IDs from status and error callbacks
// ------------------------------------------------------------------
{
IDS_CAP_BEGIN 300 /* "Capture Start" */
IDS_CAP_END 301 /* "Capture End" */

IDS_CAP_INFO 401 /* "%s" */
IDS_CAP_OUTOFMEM 402 /* "Out of memory" */
IDS_CAP_FILEEXISTS 403 /* "File ''%s'' exists -- overwrite it?" */
IDS_CAP_ERRORPALOPEN 404 /* "Error opening palette ''%s''" */
IDS_CAP_ERRORPALSAVE 405 /* "Error saving palette ''%s''" */
IDS_CAP_ERRORDIBSAVE 406 /* "Error saving frame ''%s''" */
IDS_CAP_DEFAVIEXT 407 /* "avi" */
IDS_CAP_DEFPALEXT 408 /* "pal" */
IDS_CAP_CANTOPEN 409 /* "Cannot open ''%s''" */
IDS_CAP_SEQ_MSGSTART 410 /* "Select OK to start capture\nof video sequence\nto %s." */
IDS_CAP_SEQ_MSGSTOP 411 /* "Hit ESCAPE or click to end capture" */

IDS_CAP_VIDEDITERR 412 /* "An error occurred while trying to run VidEdit." */
IDS_CAP_READONLYFILE 413 /* "The file ''%s'' is a read-only file." */
IDS_CAP_WRITEERROR 414 /* "Unable to write to file ''%s''.\nDisk may be full." */
IDS_CAP_NODISKSPACE 415 /* "There is no space to create a capture file on the specified device." */
IDS_CAP_SETFILESIZE 416 /* "Set File Size" */


IDS_CAP_SAVEASPERCENT 417 /* "SaveAs: %2ld%% Hit Escape to abort." */

IDS_CAP_DRIVER_ERROR 418 /* Driver specific error message */

IDS_CAP_WAVE_OPEN_ERROR 419 /* "Error: Cannot open the wave input device.\nCheck sample size, frequency, and channels." */
IDS_CAP_WAVE_ALLOC_ERROR 420 /* "Error: Out of memory for wave buffers." */
IDS_CAP_WAVE_PREPARE_ERROR 421 /* "Error: Cannot prepare wave buffers." */
IDS_CAP_WAVE_ADD_ERROR 422 /* "Error: Cannot add wave buffers." */
IDS_CAP_WAVE_SIZE_ERROR 423 /* "Error: Bad wave size." */

IDS_CAP_VIDEO_OPEN_ERROR 424 /* "Error: Cannot open the video input device." */
IDS_CAP_VIDEO_ALLOC_ERROR 425 /* "Error: Out of memory for video buffers." */
IDS_CAP_VIDEO_PREPARE_ERROR 426 /* "Error: Cannot prepare video buffers." */
IDS_CAP_VIDEO_ADD_ERROR 427 /* "Error: Cannot add video buffers." */
IDS_CAP_VIDEO_SIZE_ERROR 428 /* "Error: Bad video size." */


IDS_CAP_FILE_OPEN_ERROR 429 /* "Error: Cannot open capture file." */
IDS_CAP_FILE_WRITE_ERROR 430 /* "Error: Cannot write to capture file. Disk may be full." */
IDS_CAP_RECORDING_ERROR 431 /* "Error: Cannot write to capture file. Data rate too high or disk full." */
IDS_CAP_RECORDING_ERROR2 432 /* "Error while recording" */
IDS_CAP_AVI_INIT_ERROR 433 /* "Error: Unable to initialize for capture." */
IDS_CAP_NO_FRAME_CAP_ERROR 434 /* "Warning: No frames captured.\nConfirm that vertical sync interrupts\nare configured and enabled." */
IDS_CAP_NO_PALETTE_WARN 435 /* "Warning: Using default palette." */
IDS_CAP_MCI_CONTROL_ERROR 436 /* "Error: Unable to access MCI device." */
IDS_CAP_MCI_CANT_STEP_ERROR 437 /* "Error: Unable to step MCI device." */
IDS_CAP_NO_AUDIO_CAP_ERROR 438 /* "Error: No audio data captured.\nCheck audio card settings." */
IDS_CAP_AVI_DRAWDIB_ERROR 439 /* "Error: Unable to draw this data format." */


IDS_CAP_COMPRESSOR_ERROR 440 /* "Error: Unable to initialize compressor." */
IDS_CAP_AUDIO_DROP_ERROR 441 /* "Error: Audio data was lost during capture, reduce capture rate." */

/* status string IDs */
IDS_CAP_STAT_LIVE_MODE 500 /* "Live window" */
IDS_CAP_STAT_OVERLAY_MODE 501 /* "Overlay window" */
IDS_CAP_STAT_CAP_INIT 502 /* "Setting up for capture - Please wait" */
IDS_CAP_STAT_CAP_FINI 503 /* "Finished capture, now writing frame %ld" */
IDS_CAP_STAT_PALETTE_BUILD 504 /* "Building palette map" */
IDS_CAP_STAT_OPTPAL_BUILD 505 /* "Computing optimal palette" */
IDS_CAP_STAT_I_FRAMES 506 /* "%d frames" */
IDS_CAP_STAT_L_FRAMES 507 /* "%ld frames" */
IDS_CAP_STAT_CAP_L_FRAMES 508 /* "Captured %ld frames" */
IDS_CAP_STAT_CAP_AUDIO 509 /* "Capturing audio" */
IDS_CAP_STAT_VIDEOCURRENT 510 /* "Captured %ld frames (%ld dropped); //%d.%03d sec." */
IDS_CAP_STAT_VIDEOAUDIO 511 /* "Captured %d.%03d sec. %ld frames (%ld dropped); //(%d.%03d fps). %ld audio bytes (%d,%03d sps)" */
IDS_CAP_STAT_VIDEOONLY 512 /* "Captured %d.%03d sec. %ld frames (%ld dropped); //(%d.%03d fps)" */
IDS_CAP_STAT_FRAMESDROPPED 513 /* "Dropped %ld of %ld frames (%d.%02d%%); //during capture." */
}

implementation

function mmioFOURCC(const c0,c1,c2,c3:Char):FOURCC;
begin
result.High.Hi:=Byte(c0);
result.High.Lo:=Byte(c1);
result.Low.Hi:=Byte(c2);
result.Low.Lo:=Byte(c3);
end;

procedure capSetCallbackOnError(hCapWnd:hwnd; fpProc:Lparam);
begin
SendMessage(hCapWnd, WM_CAP_SET_CALLBACK_ERROR, 0, fpProc)
end;

procedure capSetCallbackOnStatus(hCapWnd:hwnd; fpProc:LParam);
begin
SendMessage(hCapWnd, WM_CAP_SET_CALLBACK_Status, 0, fpProc)
end;

procedure capSetCallbackOnYield(hCapWnd:hwnd; fpProc:LParam);
begin
SendMessage(hCapWnd, WM_CAP_SET_CALLBACK_YIELD, 0, fpProc)
end;

procedure capSetCallbackOnFrame(hCapWnd:hwnd; fpProc:LParam);
begin
SendMessage(hCapWnd, WM_CAP_SET_CALLBACK_FRAME, 0, fpProc)
end;

procedure capSetCallbackOnVideoStream(hCapWnd:hwnd; fpProc:LParam);
begin
SendMessage(hCapWnd, WM_CAP_SET_CALLBACK_VideoSTREAM, 0, fpProc)
end;

procedure capSetCallbackOnWaveStream(hCapWnd:hwnd; fpProc:LParam);
begin
SendMessage(hCapWnd, WM_CAP_SET_CALLBACK_WAVESTREAM , 0, fpProc)
end;

procedure capSetCallbackOnCapControl(hCapWnd:hwnd; fpProc:LParam);
begin
SendMessage(hCapWnd, WM_CAP_SET_CALLBACK_CapControl , 0, fpProc)
end;

procedure capGetUserData(hCapWnd:hwnd);
begin
SendMessage(hCapWnd, WM_CAP_GET_USER_DATA , 0, 0)
end;

procedure capSetUserData(hCapWnd:hwnd;lUser:LParam);
begin
SendMessage(hCapWnd, WM_CAP_SET_USER_DATA , 0, lUser)
end;

function capDriverConnect(hCapWnd:hwnd; i:wParam):Boolean;
begin
result:=SendMessage(hCapWnd, WM_CAP_DRIVER_CONNECT ,i , 0)<>0;
end;

procedure capDriverDisconnect(hCapWnd:hwnd);
begin
SendMessage(hCapWnd, WM_CAP_DRIVER_DISCONNECT ,0 , 0)
end;

procedure capDriverGetName(hCapWnd:hwnd; szName:wParam; wSize:LParam);
begin
SendMessage(hCapWnd, WM_CAP_DRIVER_Get_Name ,szName , wSize)
end;

procedure capDriverGetVersion(hCapWnd:hwnd; szVer:wParam; wSize:LParam);
begin
SendMessage(hCapWnd, WM_CAP_DRIVER_Get_VERSION ,szVer , wSize)
end;

procedure capDriverGetCaps(hCapWnd:hwnd; s:wParam; wSize:LParam);
begin
SendMessage(hCapWnd, WM_CAP_DRIVER_Get_CAPS ,s , wSize)
end;

procedure capFileSetCaptureFile(hCapWnd:hwnd; szName :LPARAM);
begin
SendMessage(hCapWnd, WM_CAP_FILE_SET_CAPTURE_FILE ,0 , szName)
end;

procedure capFileGetCaptureFile(hCapWnd:hwnd; szName :wPARAM; wSize :lPARAM);
begin
SendMessage(hCapWnd, WM_CAP_FILE_GET_CAPTURE_FILE , szName,wSize)
end;

procedure capFileAlloc(hCapWnd:hwnd; dwSize :LPARAM);
begin
SendMessage(hCapWnd, WM_CAP_FILE_ALLOCATE , 0,dwSize)
end;

procedure capFileSaveAs(hCapWnd:hwnd; szName :LPARAM);
begin
SendMessage(hCapWnd, WM_CAP_FILE_SAVEAS , 0,szName)
end;

procedure capFileSetInfoChunk(hCapWnd:hwnd; lpInfoChunk :LPARAM);
begin
SendMessage(hCapWnd, WM_CAP_FILE_SET_INFOCHUNK , 0,lpInfoChunk)
end;

procedure capFileSaveDIB(hCapWnd:hwnd; szName :LPARAM);
begin
SendMessage(hCapWnd, WM_CAP_FILE_SAVEDIB , 0,szName)
end;

procedure capEditCopy(hCapWnd:hwnd);
begin
SendMessage(hCapWnd, WM_CAP_EDIT_COPY , 0,0)
end;

procedure capSetAudioFormat(hCapWnd:hwnd; s :WPARAM; wSize :LPARAM);
begin
SendMessage(hCapWnd, WM_CAP_SET_AUDIOFORMAT , s,wSize)
end;

procedure capGetAudioFormat(hCapWnd:hwnd; s :WPARAM; wSize :LPARAM);
begin
SendMessage(hCapWnd, WM_CAP_GET_AUDIOFORMAT , s,wSize)
end;

procedure capGetAudioFormatSize(hCapWnd:hwnd);
begin
SendMessage(hCapWnd, WM_CAP_GET_AUDIOFORMAT , 0,0)
end;

procedure capDlgVideoFormat(hCapWnd:hwnd);
begin
SendMessage(hCapWnd, WM_CAP_DLG_VIDEOFORMAT , 0,0)
end;

procedure capDlgVideoSource(hCapWnd:hwnd);
begin
SendMessage(hCapWnd, WM_CAP_DLG_VIDEOSOURCE , 0,0)
end;

procedure capDlgVideoDisplay(hCapWnd:hwnd);
begin
SendMessage(hCapWnd, WM_CAP_DLG_VIDEODISPLAY , 0,0)
end;

procedure capDlgVideoCompression(hCapWnd:hwnd);
begin
SendMessage(hCapWnd, WM_CAP_DLG_VIDEOCOMPRESSION , 0,0)
end;

procedure capGetVideoFormat(hCapWnd:hwnd; s:WPARAM; wSize:LPARAM);
begin
SendMessage(hCapWnd, WM_CAP_GET_VIDEOFORMAT , s,wSize)
end;

procedure capGetVideoFormatSize(hCapWnd:hwnd);
begin
SendMessage(hCapWnd, WM_CAP_GET_VIDEOFORMAT , 0,0)
end;

procedure capSetVideoFormat(hCapWnd:hwnd; s:WPARAM; wSize:LPARAM);
begin
SendMessage(hCapWnd, WM_CAP_GET_VIDEOFORMAT , 0,0)
end;

procedure capPreview(hCapWnd:hwnd; f :WPARAM);
begin
SendMessage(hCapWnd, WM_CAP_SET_PREVIEW , f,0)
end;

procedure capPreviewRate(hCapWnd:hwnd; wMS :WPARAM);
begin
SendMessage(hCapWnd, WM_CAP_SET_PREVIEWRATE , wMS,0)
end;

procedure capOverlay(hCapWnd:hwnd; f :WPARAM);
begin
SendMessage(hCapWnd, WM_CAP_SET_OVERLAY , f,0)
end;

procedure capPreviewScale(hCapWnd:hwnd; f :WPARAM);
begin
SendMessage(hCapWnd, WM_CAP_SET_SCALE , f,0)
end;

procedure capGetStatus(hCapWnd:hwnd; s:WPARAM; wSize:LPARAM);
begin
SendMessage(hCapWnd, WM_CAP_GET_STATUS , s,wSize)
end;

procedure capSetScrollPos(hCapWnd:hwnd; lpP :LPARAM);
begin
SendMessage(hCapWnd, WM_CAP_SET_SCROLL , 0,lpP)
end;

procedure capGrabFrame(hCapWnd:hwnd);
begin
SendMessage(hCapWnd, WM_CAP_GRAB_FRAME , 0,0)
end;

procedure capGrabFrameNoStop(hCapWnd:hwnd);
begin
SendMessage(hCapWnd, WM_CAP_GRAB_FRAME_NOSTOP , 0,0)
end;

procedure capCaptureSequence(hCapWnd:hwnd);
begin
SendMessage(hCapWnd, WM_CAP_SEQUENCE , 0,0)
end;

procedure capCaptureSequenceNoFile(hCapWnd:hwnd);
begin
SendMessage(hCapWnd, WM_CAP_SEQUENCE_NOFILE , 0,0)
end;

procedure capCaptureStop(hCapWnd:hwnd);
begin
SendMessage(hCapWnd, WM_CAP_Stop , 0,0)
end;

procedure capCaptureAbort(hCapWnd:hwnd);
begin
SendMessage(hCapWnd, WM_CAP_ABORT , 0,0)

end;

procedure capCaptureSingleFrameOpen(hCapWnd:hwnd);
begin
SendMessage(hCapWnd, WM_CAP_SINGLE_FRAME_OPEN , 0,0)
end;

procedure capCaptureSingleFrameClose(hCapWnd:hwnd);
begin
SendMessage(hCapWnd, WM_CAP_SINGLE_FRAME_CLOSE , 0,0)
end;

procedure capCaptureSingleFrame(hCapWnd:hwnd);
begin
SendMessage(hCapWnd, WM_CAP_SINGLE_FRAME , 0,0)
end;

procedure capCaptureGetSetup(hCapWnd:hwnd; s:WPARAM; wSize:LPARAM);
begin
SendMessage(hCapWnd, WM_CAP_GET_SEQUENCE_SETUP , s,wSize)
end;

procedure capCaptureSetSetup(hCapWnd:hwnd; s:WPARAM; wSize:LPARAM);
begin
SendMessage(hCapWnd, WM_CAP_SET_SEQUENCE_SETUP , s,wSize)
end;

procedure capSetMCIDeviceName(hCapWnd:hwnd; szName:LPARAM);
begin
SendMessage(hCapWnd, WM_CAP_SET_MCI_DEVICE , 0,szName)
end;

procedure capGetMCIDeviceName(hCapWnd:hwnd; szName:LPARAM; wSize:WPARAM);
begin
SendMessage(hCapWnd, WM_CAP_GET_MCI_DEVICE , wSize,szName)
end;

procedure capPaletteOpen(hCapWnd:hwnd; szName:LPARAM);
begin
SendMessage(hCapWnd, WM_CAP_PAL_OPEN , 0,szName)
end;

procedure capPaletteSave(hCapWnd:hwnd; szName:LPARAM);
begin
SendMessage(hCapWnd, WM_CAP_PAL_SAVE , 0,szName)
end;

procedure capPalettePaste(hCapWnd:hwnd);
begin
SendMessage(hCapWnd, WM_CAP_PAL_PASTE , 0,0)
end;

procedure capPaletteAuto(hCapWnd:hwnd; iFrames:WPARAM; iColors :LPARAM);
begin
SendMessage(hCapWnd, WM_CAP_PAL_AUTOCREATE , iFrames,iColors)
end;

procedure capPaletteManual(hCapWnd:hwnd; fGrab :WPARAM; iColors :LPARAM);
begin
SendMessage(hCapWnd, WM_CAP_PAL_MANUALCREATE , fGrab,iColors)
end;

end.
================================================================================
Unit AviCap;
{
This code was written by : A. Waintrub
email: awaint1102@aol.com
This code is copyright 1997 by
A. Waintrub
+++++++++++++++++++++++++++++++++++++++++++++++++++

+ NUR F躌 PRIVATE NUTZUNG!!! +
+++++++++++++++++++++++++++++++++++++++++++++++++++}

interface

uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, extctrls,
AviCapH;


type
TAviCap = class(TCustomPanel)
private
{ Private Declarations }
RequestMicroSecPerFrame:dword;
MakeUserHitOKToCapture:LongBool;
PercentDropForError:Byte;
Yield:bool;
IndexSize:dword;
ChunkGranularity:dword;
UsingDOSMemory:Bool;
NumVideoRequested:dword;
CaptureAudio:Bool;
NumAudioRequested:Byte;
KeyAbort:Word;
AbortLeftMouse:bool;
AbortRightMouse:bool;
LimitEnabled:bool;
TimeLimit:Byte;
MCIControl:bool;
StepMCIDevice:bool;
MCIStartTime:dword;
MCIStopTime:dword;
StepCaptureAt2x:bool;
StepCaptureAverageFrames:Byte;
AudioBufferSize:dword;
DisableWriteCache:bool;
StreamMaster:Word;
FCapWndHandle: THandle;


FConnected: boolean;
FDriverDescripton: TStringList;
FAviFileNAme:String;
FOverlay:boolean;
FScale:boolean;
capturing:boolean;
FCaptureParms:TCaptureParms;
dummy:Boolean;
protected
{ Protected Declarations }
procedure Connect(b:Boolean);
procedure SetAviFileName(S:String);
procedure SetOverlay(b:boolean);
procedure SetScale(b:boolean);
procedure Disconnect;
Procedure DlgSource(B:Boolean);
Procedure DlgFormat(B:Boolean);
Procedure DlgCompression(B:Boolean);
Procedure DlgDisplay(B:Boolean);
public
{ Public Declarations }
DC:HDC;
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure paint;override;
procedure StartCapture;
procedure StopCApture;
property cap_DriverDescripton: TStringList read FDriverDescripton;
property cap_WndHandle: THandle read FCapWndHandle;
published
property cap_Connected: boolean read FConnected write connect;
property cap_DlgVideoCompression: boolean read dummy write DlgCompression;
property cap_DlgVideoSourece: boolean read dummy write DlgSource;
property cap_DlgVideoDisplay: boolean read dummy write DlgDisplay;
property cap_DlgVideoFormat: boolean read dummy write DlgFormat;
property cap_AviFileName:String read FAviFileNAme write SetAviFileNAme;
property cap_Overlay:Boolean read FOverlay write SetOverlay;
property cap_Scale:Boolean read FScale write SetScale;
property cap_OptRequestMicroSecPerFrame:DWORD read RequestMicroSecPerFrame
write RequestMicroSecPerFrame;
property cap_OptMakeUserHitOKToCapture:Bool read MakeUserHitOKToCapture
write MakeUserHitOKToCapture;
property cap_OptPercentDropForError:Byte read PercentDropForError
write PercentDropForError;
property cap_OptYield:Bool read Yield
write Yield;
property cap_OptIndexSize:dword read IndexSize
write IndexSize;
property cap_OptChunkGranularity:dword read ChunkGranularity
write ChunkGranularity;
property cap_OptUsingDOSMemory:Bool read UsingDOSMemory
write UsingDOSMemory;
property cap_OptNumVideoRequested:dword read NumVideoRequested
write NumVideoRequested;
property cap_OptCaptureAudio:LongBool read CaptureAudio
write CaptureAudio;
property cap_OptNumAudioRequested:Byte read NumAudioRequested
write NumAudioRequested;
property cap_OptKeyAbort:Word read KeyAbort
write KeyAbort;
property cap_OptAbortLeftMouse:Bool read AbortLeftMouse
write AbortLeftMouse;
property cap_OptAbortRightMouse:Bool read AbortRightMouse
write AbortRightMouse;
property cap_OptLimitEnabled:Bool read LimitEnabled
write LimitEnabled;
property cap_OptTimeLimit:Byte read TimeLimit
write TimeLimit;
property cap_OptMCIControl:Bool read MCIControl
write MCIControl;
property cap_OptStepMCIDevice:Bool read StepMCIDevice
write StepMCIDevice;
property cap_OptMCIStartTime:dword read MCIStartTime
write MCIStartTime;
property cap_OptMCIStopTime:dword read MCIStopTime
write MCIStopTime;
property cap_OptStepCaptureAt2x:Bool read StepCaptureAt2x
write StepCaptureAt2x;
property cap_OptStepCaptureAverageFrames:Byte read StepCaptureAverageFrames
write StepCaptureAverageFrames;
property cap_OptAudioBufferSize:dword read AudioBufferSize
write AudioBufferSize;
property cap_OptDisableWriteCache:Bool read DisableWriteCache
write DisableWriteCache;
property cap_OptAVStreamMaster:Word read StreamMaster
write StreamMaster;
end;

procedure Register;

implementation
{$R *.DCR}

constructor TAviCap.Create(AOwner: TComponent);
var
a1,a2:ARRAY [0..127] of char;


b:Byte;
begin
inherited Create(AOwner);
parent:=AOwner as TWinCOntrol;
capturing:=false;
width:=260;
height:=180;
FDriverDescripton:=TStringList.Create;
for b :=0 to 8 do
if capGetDriverDescriptionA(b,a1,128,a2,128)then
FDriverDescripton.Add(a1) else break;
FCapWndHandle:=capCreateCaptureWindowA('''',WS_VISIBLE+WS_CHILD+WS_BORDER,
0,0,0,0,handle,0);
FAviFileNAMe:=''C:\Capture.avi'';
capCaptureGetSetup (FCapWndHandle,WParam(SizeOf(TCaptureParms)),
LParam(@(FCaptureParms)));
with FCaptureParms do
begin
RequestMicroSecPerFrame:=dwRequestMicroSecPerFrame;
MakeUserHitOKToCapture:=fMakeUserHitOKToCapture;
PercentDropForError:=wPercentDropForError;
Yield:=fYield;
IndexSize:=dwIndexSize;
ChunkGranularity:=wChunkGranularity;
UsingDOSMemory:=fUsingDOSMemory;
NumVideoRequested:=wNumVideoRequested;
CaptureAudio:=fCaptureAudio;
NumAudioRequested:=wNumAudioRequested;


KeyAbort:=vKeyAbort;
AbortLeftMouse:=fAbortLeftMouse;
AbortRightMouse:=fAbortRightMouse;
LimitEnabled:=fLimitEnabled;
TimeLimit:=wTimeLimit;
MCIControl:=fMCIControl;
StepMCIDevice:=fStepMCIDevice;
MCIStartTime:=dwMCIStartTime;
MCIStopTime:=dwMCIStopTime;
StepCaptureAt2x:=fStepCaptureAt2x;
StepCaptureAverageFrames:=wStepCaptureAverageFrames;
AudioBufferSize:=dwAudioBufferSize;
DisableWriteCache:=fDisableWriteCache;
StreamMaster:=AVStreamMaster;
end;
FOverlay:=True;
end;

destructor TAviCap.Destroy;
begin
if FConnected then disconnect;
if assigned(FDriverDescripton) then FDriverDescripton.free;
DeleteDC(DC);
CloseHandle(FCapWndHandle);
inherited Destroy;
end;

procedure TAviCap.Connect(b:Boolean);
begin
if b then
begin
TextOut(dc,10,10,''Connecting'',10);
fconnected:=capDriverConnect (FCapWndHandle, 0);
SetOverlay(FOverlay);
end
else disconnect;
end;

procedure TAviCap.Disconnect;
var
B:boolean;
begin
b:=FOverlay;
SetOverlay(False);
capDriverDisconnect(FCapWndHandle);
fconnected:=False;
SetOverlay(b);
end;

procedure TAviCap.Paint;
begin
inherited Paint;
SetWindowPos(FCapWndHandle,HWND_TOP,0,0,width,height,SWP_SHOWWINDOW);
if dc=0 then dc:=Getdc(FCapWndHandle);
If csDesigning in ComponentState then TextOut(dc,10,10,PChar(NAme),Length(NAme));
end;

procedure TAviCap.SetAviFileName(S:String);
begin
capFileSetCaptureFile (FCapWndHandle, LParam(PChar(s)));
FAVIFileNAme:=s;
end;

procedure TAviCap.SetOverlay(b:boolean);
begin
capOverlay (FCapWndHandle, WPARAM(b));
FOverlay:=b;
end;

procedure TAviCap.SetScale(b:boolean);
begin
capPreviewScale (FCapWndHandle, WPARAM(b));
FScale:=b;
end;

procedure TAviCAp.StartCapture;
var
b:Boolean;
begin
SetAviFileName(FAviFileNAme);
b:=FOverlay;


SetOverlay(false);
capCaptureSetSetup (FCapWndHandle,WParam(SizeOf(FCaptureParms)),
LParam(@(FCaptureParms)));
capPreview (FCapWndHandle, WPARAM(True));
capCaptureSequence (FCapWndHandle);
setOverlay(b);
end;

procedure TAviCAp.StopCapture;
begin
capCaptureStop (FCapWndHandle);
end;

Procedure TAviCap.DlgSource(B:Boolean);
begin
capDlgVideoSource (FCapWndHandle);
end;

Procedure TAviCAp.DlgFormat(B:Boolean);
begin
capDlgVideoFormat (FCapWndHandle);
end;

Procedure TAviCap.DlgCompression(B:Boolean);
begin
capDlgVideoCompression (FCapWndHandle);
end;

Procedure TAviCap.DlgDisplay(B:Boolean);
begin
capDlgVideoDisplay (FCapWndHandle);
end;

procedure Register;
begin
RegisterComponents(''Free'', [TAviCap]);
end;

end. 如金蝶进销存软件

3楼: 谢谢

4楼: 谢谢

5楼: 接受答案了.

6楼: 顶下..