Показать сообщение отдельно
  #40  
Старый 18.01.2011, 22:26
Edos Edos вне форума
Прохожий
 
Регистрация: 17.11.2010
Сообщения: 6
Репутация: 10
По умолчанию

с верх ногами разобрался... пасибо теперь возникает еще куча вопросов
1) когда говорю ему записывай то он записывает но записывает до тех пор пока самому не надоест.
2) в savedialog указываю имя файла под которым надо сохранить видеозапись но сохранение происходит под другим именем в основном под именем "D" и еще и без расширения...
вот код... помогите люди добрые)))))
Код:
unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    Panel1: TPanel;
    Button1: TButton;
    Button2: TButton;
    Button4: TButton;
    Button5: TButton;
    Button6: TButton;
    SaveDialog1: TSaveDialog;
    Timer1: TTimer;
    procedure FormCreate(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button4Click(Sender: TObject);
    procedure Button5Click(Sender: TObject);
    procedure Button6Click(Sender: TObject);
    procedure Timer1Timer(Sender: TObject);
  private
    { Private declarations }
    hwndc: THandle;
    Capturingavi: bool;

  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation
const
  WM_CAP_START = WM_USER;
const
  WM_CAP_STOP = WM_CAP_START + 68;
const
  WM_CAP_DRIVER_CONNECT = WM_CAP_START + 10;
const
  WM_CAP_DRIVER_DISCONNECT = WM_CAP_START + 11;
const
  WM_CAP_SAVEDIB = WM_CAP_START + 25;
const
  WM_CAP_GRAB_FRAME = WM_CAP_START + 60;
const
  WM_CAP_SEQUENCE = WM_CAP_START + 62;
const
  WM_CAP_FILE_SET_CAPTURE_FILEA = WM_CAP_START + 20;


{$R *.dfm}
function capCreateCaptureWindowA(lpszWindowName: PCHAR;
  dwStyle: longint;
  x: integer;
  y: integer;
  nWidth: integer;
  nHeight: integer;
  ParentWin: HWND;
  nId: integer): HWND;
  stdcall external 'AVICAP32.DLL';


procedure TForm1.Button1Click(Sender: TObject);
begin
 hWndC := capCreateCaptureWindowA('Записывающее Окно',
    WS_CHILD or WS_VISIBLE,
    Panel1.Left,
    Panel1.Top,
    Panel1.Width,
    Panel1.Height,
    Form1.Handle, 0);
  if hWndC <> 0 then
    SendMessage(hWndC, WM_CAP_DRIVER_CONNECT, 0, 0);
    timer1.Enabled:=true;

end;

procedure TForm1.Button2Click(Sender: TObject);
begin
 if hWndC <> 0 then
  begin
    SendMessage(hWndC, WM_CAP_DRIVER_DISCONNECT, 0, 0);
    hWndC := 0;
  end;

end;

procedure TForm1.Button4Click(Sender: TObject);
begin
 if hWndC <> 0 then
  begin
    SaveDialog1.DefaultExt := 'bmp';
    SaveDialog1.Filter := 'Bitmap files (*.bmp)|*.bmp';
    if SaveDialog1.Execute then
      SendMessage(hWndC,
        WM_CAP_SAVEDIB,
        0,
        longint(pchar(SaveDialog1.FileName)));
  end;

end;

procedure TForm1.Button5Click(Sender: TObject);
begin
if hWndC <> 0 then
  begin
    SaveDialog1.DefaultExt := 'avi';
    SaveDialog1.Filter := 'AVI files (*.avi)|*.avi';
    if SaveDialog1.Execute then
    begin
      CapturingAVI := true;
      SendMessage(hWndC,
        WM_CAP_FILE_SET_CAPTURE_FILEA,
        0,
        Longint(pchar(SaveDialog1.FileName)));
      SendMessage(hWndC, WM_CAP_SEQUENCE, 0, 0);
    end;
  end;

end;

procedure TForm1.Button6Click(Sender: TObject);
begin
 if hWndC <> 0 then
  begin
    SendMessage(hWndC, WM_CAP_STOP, 0, 0);
    CapturingAVI := false;
  end;
end;



procedure TForm1.FormCreate(Sender: TObject);
begin
 CapturingAVI := false;
  hWndC := 0;
  SaveDialog1.Options :=[ofHideReadOnly, ofNoChangeDir, ofPathMustExist]

end;

procedure TForm1.Timer1Timer(Sender: TObject);
begin
if hWndC <> 0 then
    SendMessage(hWndC, WM_CAP_GRAB_FRAME, 0, 0);
end;

end.
Админ: Пользуемся тегами, читаем правила!
Ответить с цитированием