📄 main.pas
字号:
unit Main;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,VFW, ExtCtrls;
type
TForm1 = class(TForm)
DriverIndexLabel: TLabel;
DriverIndexComboBox: TComboBox;
DriverNameLabel: TLabel;
DriverNameText: TStaticText;
DriverVersionLabel: TLabel;
DriverVersionText: TStaticText;
DriverCountLabel: TLabel;
DriverCountText: TStaticText;
VideoCapPanel: TPanel;
ConnectButton: TButton;
DisConnectButton: TButton;
procedure DriverIndexComboBoxChange(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure ConnectButtonClick(Sender: TObject);
procedure DisConnectButtonClick(Sender: TObject);
private
{ Private declarations }
FVideoCapWinH:THandle;
FIsConnect:Boolean;
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);
FVideoCapWinH:=capCreateCaptureWindow (
'TEST',WS_CHILD or WS_VISIBLE,0,0,VideoCapPanel.Width,VideoCapPanel.Height,VideoCapPanel.Handle,0);
FIsConnect:=FALSE;
end;
procedure TForm1.DriverIndexComboBoxChange(Sender: TObject);
var
wDriverIndex:DWORD;
DrvName:array[0..80] of char;
DrvVer:array[0..80] of char;
errmsg:string;
begin
if FIsConnect then DisConnectButtonClick(nil);
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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -