以下程序抄来并经过修改,可在本机上实时截屏(包括realplay播放),谁把他用winsocket
写成远程监视程序?
unit directxzp;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
DXDraws, StdCtrls, DXClass,DIB,DirectX, DXPlay;
type
TForm1 = class(TForm)
DXDraw1: TDXDraw;
DXTimer1: TDXTimer;
procedure DXDraw1InitializeSurface(Sender: TObject);
procedure DXDraw1FinalizeSurface(Sender: TObject);
procedure FormClose(Sender: TObject;
var Action: TCloseAction);
procedure FormShow(Sender: TObject);
procedure DXTimer1Timer(Sender: TObject;
LagCount: Integer);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
FSurface:TDirectDrawSurface;
ScrDC:HDC;
i:Integer;
WW,HH:Integer;
mPos:TPoint;
posX,posY:Integer;
implementation
{$R *.DFM}
procedure TForm1.DXDraw1InitializeSurface(Sender: TObject);
begin
FSurface:=TDirectDrawSurface.Create(DXDraw1.DDraw);
WW:=screen.Height;
HH:=Screen.Width;
FSurface.SetSize(WW,HH);
FSurface.SystemMemory:=true;
fsurface.Fill(0);
ScrDC:=getDC(0);
end;
procedure TForm1.DXDraw1FinalizeSurface(Sender: TObject);
begin
FSurface.Free;
FSurface:=nil;
end;
procedure TForm1.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
DXTimer1.Enabled:=False;
end;
procedure TForm1.FormShow(Sender: TObject);
begin
DXTimer1.Enabled:=True;
end;
procedure TForm1.DXTimer1Timer(Sender: TObject;
LagCount: Integer);
begin
GetCursorPos(mPos);
FSurface.Fill(11);
BitBlt(FSurface.Canvas.Handle,0,0,WW,HH,ScrDC,0,0,SRCCOPY);
FSurface.Canvas.Release;
if DXDraw1.CanDraw then
begin
DXDraw1.Surface.Draw(0,0, Rect(posX,posY,posX+DXDraw1.Width,posY+DXDraw1.Height),FSurface,false);
DXDraw1.Flip;
end;
end;
end.