怎样用DELPHI存储AVI 文件 只能定义为image字段,以二进制块的形式写在数据库中。方法是用文件流打开avi文件,复制到TBLOBStream中。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 存成avi的一例子:unit Unit1; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, ExtCtrls, StdCtrls; type TForm1 = class(TForm) Panel1: TPanel; OpenVideo: TButton; CloseVideo: TButton; GrabFrame: TButton; SaveBMP: TButton; StartAVI: TButton; StopAVI: TButton; SaveDialog1: TSaveDialog; procedure FormCreate(Sender: TObject); procedure OpenVideoClick(Sender: TObject); procedure CloseVideoClick(Sender: TObject); procedure GrabFrameClick(Sender: TObject); procedure SaveBMPClick(Sender: TObject); procedure StartAVIClick(Sender: TObject); procedure StopAVIClick(Sender: TObject); private { Private declarations } hWndC : THandle; CapturingAVI : bool; public { Public declarations } end; var Form1: TForm1; implementation {$R *.DFM} 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; 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.FormCreate(Sender: TObject); begin CapturingAVI := false; hWndC := 0; SaveDialog1.Options := [ofHideReadOnly, ofNoChangeDir, ofPathMustExist] end; procedure TForm1.OpenVideoClick(Sender: TObject); begin hWndC := capCreateCaptureWindowA('My Own Capture Window', 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); end; procedure TForm1.CloseVideoClick(Sender: TObject); begin if hWndC <> 0 then begin SendMessage(hWndC, WM_CAP_DRIVER_DISCONNECT, 0, 0); hWndC := 0; end; end; procedure TForm1.GrabFrameClick(Sender: TObject); begin if hWndC <> 0 then SendMessage(hWndC, WM_CAP_GRAB_FRAME, 0, 0); end; procedure TForm1.SaveBMPClick(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.StartAVIClick(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.StopAVIClick(Sender: TObject); begin if hWndC <> 0 then begin SendMessage(hWndC, WM_CAP_STOP, 0, 0); CapturingAVI := false; end; end; end. 你只需要存储AVI文件的文件名就可以了,从一个文本文件里读取不就玩了不用那么复杂的 一个关于树的使用问题 ado连接数据方法问题! 谁能告诉我 INTERBASE的连接问题 明天 我再送分给好汉们 整数与字符串的转换 弟兄们,帮帮我. delphi中可否直接使用Sql语句(象pb一样)?如果可以该怎么写? 如何得到用opendialog打开的文件的路径 我该用哪个Chart:chartfx?DBChart? 在Delphi中,如何使用RAS函数? 不是高手的不要进来!!! 怎样给在一个Treeview 加一个背景图片,? 大家帮忙看看这几行代码,一时找不出问题来。
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls; type
TForm1 = class(TForm)
Panel1: TPanel;
OpenVideo: TButton;
CloseVideo: TButton;
GrabFrame: TButton;
SaveBMP: TButton;
StartAVI: TButton;
StopAVI: TButton;
SaveDialog1: TSaveDialog;
procedure FormCreate(Sender: TObject);
procedure OpenVideoClick(Sender: TObject);
procedure CloseVideoClick(Sender: TObject);
procedure GrabFrameClick(Sender: TObject);
procedure SaveBMPClick(Sender: TObject);
procedure StartAVIClick(Sender: TObject);
procedure StopAVIClick(Sender: TObject);
private
{ Private declarations }
hWndC : THandle;
CapturingAVI : bool;
public
{ Public declarations }
end; var
Form1: TForm1; implementation {$R *.DFM} 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; 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.FormCreate(Sender: TObject);
begin
CapturingAVI := false;
hWndC := 0;
SaveDialog1.Options :=
[ofHideReadOnly, ofNoChangeDir, ofPathMustExist]
end; procedure TForm1.OpenVideoClick(Sender: TObject);
begin
hWndC := capCreateCaptureWindowA('My Own Capture Window',
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);
end; procedure TForm1.CloseVideoClick(Sender: TObject);
begin
if hWndC <> 0 then begin
SendMessage(hWndC, WM_CAP_DRIVER_DISCONNECT, 0, 0);
hWndC := 0;
end;
end; procedure TForm1.GrabFrameClick(Sender: TObject);
begin
if hWndC <> 0 then
SendMessage(hWndC, WM_CAP_GRAB_FRAME, 0, 0);
end; procedure TForm1.SaveBMPClick(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.StartAVIClick(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.StopAVIClick(Sender: TObject);
begin
if hWndC <> 0 then begin
SendMessage(hWndC, WM_CAP_STOP, 0, 0);
CapturingAVI := false;
end;
end; end.
不用那么复杂的