uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, IdUDPServer, IdBaseComponent, IdComponent, IdUDPBase, IdUDPClient,
StdCtrls, ExtCtrls, Jpeg ,VFW ,IdSocketHandle;
type
TForm1 = class(TForm)
Panel1: TPanel;
Panel2: TPanel;
Image1: TImage;
Button1: TButton;
Button2: TButton;
Button3: TButton;
IdUDPClient1: TIdUDPClient;
IdUDPServer1: TIdUDPServer;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
CapWnd:THandle;
CapParms:TcaptureParms;
BMPINFO:TBitmapInfo;
implementation
{$R *.dfm}
function FrameCallBack(hWnd: HWND; lpVHdr: PVIDEOHDR): LongInt;stdcall;
var
hd:Thandle;
jpg:TJpegImage;
memStream :TMemoryStream;
Bitmap:TBitmap;
begin
Bitmap:=TBitmap.Create;
Bitmap.Width :=BMPINFO.bmiHeader.biWidth;
Bitmap.Height:=BMPINFO.bmiHeader.biHeight;
hd:= DrawDibOpen;
DrawDibDraw(hd,Bitmap.canvas.handle,0,0,BMPINFO.BmiHeader.biwidth,
BMPINFO.bmiheader.biheight,@BMPINFO.bmiHeader,
lpVHdr^.lpData,0,0,BMPINFO.bmiHeader.biWidth,BMPINFO.bmiHeader.biheight,0);
DrawDibClose(hd);
memStream := TMemoryStream.Create;
jpg := TJpegImage.Create;
jpg.Assign(Bitmap);
jpg.CompressionQuality := 20;
jpg.JPEGNeeded;
jpg.Compress;
jpg.SaveToStream(memStream);
jpg.Free;
Form1.IdUDPClient1.BroadcastEnabled:=true;
if memStream.Size>Form1.IdUDPClient1.BufferSize then
Form1.IdUDPClient1.SendBuffer
('192.168.1.255',9001,memStream.Memory^,Form1.IdUDPClient1.BufferSize)
else
Form1.IdUDPClient1.SendBuffer
('192.168.1.255',9001,memStream.Memory^,memStream.Size);
memStream.Free;
Bitmap.Free;
end;
.........
執行到“Form1.IdUDPClient1.SendBuffer(192.168.1.255',9001,memStream.Memory^,Form1.IdUDPClient1.BufferSize)
”無法繼續執行,報錯為“[DCC Error] server1.pas(87): E2250 There is no overloaded version of 'SendBuffer' that can be called with these arguments”。
uj5u.com熱心網友回復:
Indy版本不對uj5u.com熱心網友回復:
編譯出錯吧?Indy版本不對,函式的引數不一樣了
uj5u.com熱心網友回復:
謝謝s11ss!!!謝謝sz_haitao!!!
已解決,我用的是2010版。
uj5u.com熱心網友回復:
請教是怎么解決的啊?謝謝uj5u.com熱心網友回復:
我也是使用delphi2010,同樣的問題,謝謝給點提示.轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/151875.html
標籤:VCL組件開發及應用
上一篇:接受單片機串口資料不完整
