程序如下,VFW.PAS已经添加
unit VideoCapDrivers;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
ComboBox1: TComboBox;
Label1: TLabel;
Label2: TLabel;
StaticText1: TStaticText;
Label3: TLabel;
StaticText2: TStaticText;
Label4: TLabel;
StaticText3: TStaticText;
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;
StaticText3.Caption:=inttostr(DrvCount);
end;
end.
错误报告:
[Error] VideoCapDrivers.pas(43): Undeclared identifier: 'capGetDriverDescription'
请问怎么会有这样的错误呢?如何解决?
------解决方案--------------------------------------------------------
var
Form1: TForm1;
implementation
uses vfw;
{$R *.dfm}
注:在此处添加 uses vfw;
虽然你工程中添加了vfw.pas,但你在此单元中未引用vfw.pas,所以未能解capGetDriverDescription函数
------解决方案--------------------------------------------------------
对呀,最好没忘记引用相关的“单元”