unit about;

{$mode objfpc}{$H+}

interface

uses
  Windows, Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, okapi32;

type

  { TAboutBox }

  TAboutBox = class(TForm)
    btnOK: TButton;
    procedure btnOKClick(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
    procedure FormShow(Sender: TObject);
  private
    { private declarations }
  public
    { public declarations }
    lbl: Array [1..12] of TLabel;
  end;

const
     DisLabel = 30;
     FontSizeLabel =12;

var
  AboutBox: TAboutBox;
  lpBoardInfo:LPOKDEVTYPE;

implementation

uses
    main;

{$R *.lfm}

{ TAboutBox }

procedure TAboutBox.btnOKClick(Sender: TObject);
begin
  Close;
end;

procedure TAboutBox.FormCreate(Sender: TObject);
var
   i:Integer;
begin
  for i := Low(lbl) to High(lbl) do
  begin
       lbl[i] := TLabel.Create(Self);
       lbl[i].Parent := AboutBox;
       lbl[i].Font.Size := 12;
  end;
end;

procedure TAboutBox.FormDestroy(Sender: TObject);
var
   i:Integer;
begin
  //窗口关闭
  for i:= Low(lbl) to High(lbl) do
      if Assigned(lbl[i]) then lbl[i].Free;
end;

procedure TAboutBox.FormShow(Sender: TObject);
var
   bufbits,bufsize:Longint;
   lpPhys:^BYTE;
   lpLinear:Pointer;
   number:Longint;
   blknum:Integer;
   lw:MWORD;
   ld:DWORD;
   str:Array [0..100] of char;
   i:Integer;
begin
  //信息对话框初始化
  if (iCurrUsedNo < 0) then Close;

  total := okGetImageDevice(lpBoardInfo, 0);

  lbl[1].Caption := '当前使用的卡型：'+lpBoardInfo[iCurrUsedNo].szBoardName+'(No.'+IntToStr(iCurrUsedNo)+')';

  MLONG(lpPhys) := okGetAvailBuffer(lpLinear, dwBufSize);
  number := okGetBufferSize(hBoard, nil, dwBufSize);
  lbl[2].Caption := '序列缓存：'+IntToHex(Longword(lpPhys),0)+'('+IntToHex(Longword(lpLinear),0)+'):'+IntToStr((dwBufSize Div 1024)Div 1024)+'MB';

  bufbits := HIWORD(okSetCaptureParam(hBoard,CAPTURE_BUFRGBFORMAT,GETCURRPARAM)); //-1
  bufsize := okSetCaptureParam(hBoard,CAPTURE_BUFBLOCKSIZE,GETCURRPARAM); //-1

  lw := 0;
  number := okGetBufferSize(hBoard, nil, lw);
  lw := 0;
  blknum := okGetMemBlock(hBoard, ld, ld);
  i := dwMaxMemSize Div 1024 Div 1024;

  lbl[3].Caption := '当前缓存帧数：'+IntToStr(number-blknum)+'+'+IntToStr(blknum)+'('+IntToStr(LOWORD(bufsize))+'x'+IntToStr(HIWORD(bufsize))+'x'+IntToStr(bufbits)+')';
  lbl[4].Caption := '程序申请内存大小：'+IntToStr(i)+ ' MB';
  lbl[5].Caption := 'OK系列图象卡演示/测试程序';
  okGetProgramInfo(VERSION, str, 100);
  lbl[6].Caption := 'Copyright 1999-2024  Version ' + str;
  lbl[7].Caption := '北京嘉恒中自图像技术有限公司';
  lbl[8].Caption := 'Tel.: 400-166-5596     Fax: 010-82629477';
  lbl[9].Caption := 'Web:';
  lbl[10].Caption := 'www.jhi.com.cn';
  lbl[11].Caption := 'E_mail:';
  lbl[12].Caption := 'info@jhi.com.cn';

  for i := Low(lbl) to High(lbl) do
  begin
       lbl[i].Font.Size := FontSizeLabel;
       lbl[i].Left := (AboutBox.Width - lbl[i].Width) Div 2;
  end;

  lbl[9].Left := (AboutBox.Width - lbl[9].Width - lbl[10].Width - lbl[11].Width - lbl[12].Width) Div 2;
  lbl[10].Left := lbl[9].Left + lbl[9].Width;
  lbl[11].Left := lbl[10].Left + lbl[10].Width + 5;
  lbl[12].Left := lbl[11].Left + lbl[11].Width;

  lbl[1].Top :=20;
  for i := 2 to 9 do
  begin
       lbl[i].Top := lbl[i-1].Top + DisLabel;
  end;
  lbl[10].Top := lbl[8].Top + DisLabel;
  lbl[11].Top := lbl[8].Top + DisLabel;
  lbl[12].Top := lbl[8].Top + DisLabel;

  btnOK.Left := (AboutBox.Width - btnOK.Width ) Div 2;
end;


end.

