L
luoshitu
Unregistered / Unconfirmed
GUEST, unregistred user!
我用vfw编些了一个小程序,可是点了两下按键,程序就死了!源程序如下:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ExtCtrls, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Panel1: TPanel;
Button2: TButton;
procedure FormCreate(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
wndCap: HWND;
wndCap1: HWND;
implementation
uses vfw;
{$R *.DFM}
procedure TForm1.FormCreate(Sender: TObject);
begin
wndCap := capCreateCaptureWindow('capPhoto', WS_CHILD or WS_VISIBLE, 0, 0,
panel1.Width , panel1.Height , panel1.Handle, 0);
SendMessage(wndCap, WM_CAP_DRIVER_CONNECT, 0, 0); // 连接到第一个视频卡
SendMessage(wndCap, WM_CAP_SET_SCALE, WParam(true), 0); // 设为充满wndCap窗口
SendMessage(wndCap, WM_CAP_SET_PREVIEWRATE, 30, 0); // 设置速度
capoverlay(wndcap,true);
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
panel1.height:= panel1.height-10;
panel1.width:=panel1.width-10;
capdriverdisconnect(wndCap);
wndCap := capCreateCaptureWindow('capPhoto', WS_CHILD or WS_VISIBLE, 0, 0,
panel1.Width , panel1.Height , panel1.Handle, 0);
SendMessage(wndCap, WM_CAP_DRIVER_CONNECT, 0, 0); // 连接到第一个视频卡
SendMessage(wndCap, WM_CAP_SET_SCALE, WParam(true), 0); // 设为充满wndCap窗口
SendMessage(wndCap, WM_CAP_SET_PREVIEWRATE, 30, 0); // 设置速度
capoverlay(wndcap,true);
end;
end.
请高手帮我分析一下,哪有问题?
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ExtCtrls, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Panel1: TPanel;
Button2: TButton;
procedure FormCreate(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
wndCap: HWND;
wndCap1: HWND;
implementation
uses vfw;
{$R *.DFM}
procedure TForm1.FormCreate(Sender: TObject);
begin
wndCap := capCreateCaptureWindow('capPhoto', WS_CHILD or WS_VISIBLE, 0, 0,
panel1.Width , panel1.Height , panel1.Handle, 0);
SendMessage(wndCap, WM_CAP_DRIVER_CONNECT, 0, 0); // 连接到第一个视频卡
SendMessage(wndCap, WM_CAP_SET_SCALE, WParam(true), 0); // 设为充满wndCap窗口
SendMessage(wndCap, WM_CAP_SET_PREVIEWRATE, 30, 0); // 设置速度
capoverlay(wndcap,true);
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
panel1.height:= panel1.height-10;
panel1.width:=panel1.width-10;
capdriverdisconnect(wndCap);
wndCap := capCreateCaptureWindow('capPhoto', WS_CHILD or WS_VISIBLE, 0, 0,
panel1.Width , panel1.Height , panel1.Handle, 0);
SendMessage(wndCap, WM_CAP_DRIVER_CONNECT, 0, 0); // 连接到第一个视频卡
SendMessage(wndCap, WM_CAP_SET_SCALE, WParam(true), 0); // 设为充满wndCap窗口
SendMessage(wndCap, WM_CAP_SET_PREVIEWRATE, 30, 0); // 设置速度
capoverlay(wndcap,true);
end;
end.
请高手帮我分析一下,哪有问题?