videocapdrivers.pas

来自「多媒體視頻程序設計--使用Delphi 第五章 源碼 5-1 摄像机启」· PAS 代码 · 共 74 行

PAS
74
字号
unit VideoCapDrivers;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls,VFW;

type
  TForm1 = class(TForm)
    DriverIndexLabel: TLabel;
    DriverIndexComboBox: TComboBox;
    DriverNameLabel: TLabel;
    DriverNameText: TStaticText;
    DriverVersionLabel: TLabel;
    DriverVersionText: TStaticText;
    DriverCountLabel: TLabel;
    DriverCountText: TStaticText;
    procedure DriverIndexComboBoxChange(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
var
wDriverIndex:DWORD;
DrvCount:integer;
DrvName:array[0..80] of char;
DrvVer:array[0..80] of char;

begin

 DrvCount:=0;

 for wDriverIndex:=0 to 9 do
 if capGetDriverDescription(wDriverIndex,DrvName,sizeof(DrvName),DrvVer,sizeof(DrvName)) then
 begin
  inc(DrvCount);
 end;
 DriverCountText.Caption:=inttostr(DrvCount);


end;

procedure TForm1.DriverIndexComboBoxChange(Sender: TObject);
var
wDriverIndex:DWORD;
DrvName:array[0..80] of char;
DrvVer:array[0..80] of char;
errmsg:string;
begin

 wDriverIndex:= DriverIndexComboBox.ItemIndex;
 if capGetDriverDescription(wDriverIndex,DrvName,sizeof(DrvName),DrvVer,sizeof(DrvName)) then
 begin
  DriverNameText.Caption:= DrvName;
  DriverVersionText.Caption:= DrvVer;
 end
 else
 begin
  DriverNameText.Caption:= '';
  DriverVersionText.Caption:= '';
  Beep;
  errmsg:='Error: Driver Index='+inttostr(wDriverIndex)+'

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?