drvedit.~pas

来自「智能监控delphi源码, 操作说明 1. 在两台微机上分别运行文件夹中的可」· ~PAS 代码 · 共 86 行

~PAS
86
字号
unit drvedit;

interface



procedure Register;

implementation

 uses classes,dsgnintf,sysutils,vfw,videocap;

// Property Editor for driver selection   in Video-Cap
type TDrivereditor= class (TPropertyEditor)
  function GetAttributes:TPropertyAttributes;override;
  procedure GetValues(Proc: TGetStrProc);override;
  function GetValue:string;override;
  procedure SetValue(const Value: string);override;
end;

function TDriverEditor.GetAttributes:TPropertyAttributes;
begin
 result :=[paRevertable,paValueList];
end;


procedure TDriverEditor.GetValues(Proc: TGetStrProc);
var i:integer;
    name:array[0..80] of char;
    ver :array[0..80] of char;
    s:string;

begin
 for i:= 0 to 9 do
  begin
   if capGetDriverDescription( i,name,80,ver,80) then
      s:=strpas(name)
   else
      s:='' ;
   proc(s);
  end;

end;



function TDriverEditor.GetValue:string;

var  n:array[0..80] of char;
     ver :array[0..80] of char;
     s:string;


begin
 with Getcomponent(0) as TVideoCap do
   begin
    if capGetDriverDescription( DriverIndex,n,80,ver,80) then
      s:=strpas(n)
    else
      s:='' ;
   end;
   result:= s;               //fVideoDrivername;
end;



procedure TDriverEditor.SetValue(const Value: string);
begin
  with Getcomponent(0) as TVideoCap do
    SetDrivername( value) ;
  Modified;
end;






procedure Register;
begin

  RegisterPropertyEditor(TypeInfo(string),TVideoCap,'DriverName',TDriverEditor);
end;

end.

⌨️ 快捷键说明

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