delphi HTTP远程屏幕源码


本文整理自网络,侵删。

 使用了灰鸽子的HTTP控件ics

procedure TForm1.FormCreate(Sender: TObject);
begin
try
httpserver1.Start;//启动运行服务。设置httpserver1的属性。端口自己定义,最好不要为80目录为C盘c:\windows\
//文档为ceshi.jpg
except
showmessage('启动失败,查看端口是否占用');
end;
end;

接下来,设置一个timer控件,因为需要截图。定时截图。
procedure TForm1.Timer1Timer(Sender: TObject);
var
Fullscreen:Tbitmap;
FullscreenCanvas:TCanvas;
dc:HDC;
MyJPEG : TJPEGImage;//USES里添加jpeg引用!
begin
Fullscreen:=TBitmap.Create;
Fullscreen.Width:=screen.width;
Fullscreen.Height:=screen.Height;
DC:=GetDC(0);
FullscreenCanvas:=TCanvas.Create;
FullscreenCanvas.Handle:=DC;
Fullscreen.Canvas.CopyRect(Rect(0,0,screen.Width,screen.Height),
fullscreenCanvas,Rect(0,0,Screen.Width,Screen.Height));
FullscreenCanvas.Free;
ReleaseDC(0,DC);
myjpeg:= TJPEGImage.Create;
myjpeg.Assign(Fullscreen);
myjpeg.CompressionQuality:=10; //压缩比例,保证传输速度快
myjpeg.Compress;
try
myjpeg.SaveToFile('c:\windows\ceshi.JPG');//保存路径
myjpeg.Free;
fullscreen.free;
except
end;
end;


好了,这样基本就完成了。

再写个函数来获取本地IP,显示在程序上,这样直接点击

function GetLocalIP: string;
type
TaPInAddr = array[0..255] of PInAddr;
PaPInAddr = ^TaPInAddr;
var
phe: PHostEnt;
pptr: PaPInAddr;
Buffer: array[0..63] of char;
i: integer;
GInitData: TWSADATA;
begin
wsastartup($101, GInitData);
result := '';
GetHostName(Buffer, SizeOf(Buffer));
phe := GetHostByName(buffer);
if not assigned(phe) then
exit;
pptr := PaPInAddr(Phe^.h_addr_list);
i := 0;
while pptr^[I] <> nil do
begin
result := {Result +}StrPas(inet_ntoa(pptr^[I]^)) + ',';
inc(i);
end;
Delete(Result, Length(Result), 1);
wsacleanup;
end;

访问就是IP:端口号码,就可以了哦。timer设置个大概5秒一次就好了。这样不停刷新网页,就可以啦。

相关阅读 >>

Delphi indy 组件包里的 idhttp 组件使用 get 方法下载文件限速的方法

Delphi版本qq木马

unigui js操作Delphi控件赋值

Delphi 截取被遮挡的window画面

Delphi 简单的封装messagebox对话框

Delphi 四舍五入取整函数

Delphi中messagebox用法

Delphi 控制台关闭指定窗口

Delphi中使用activex的一些心得

Delphi使用tnethttpclient:重定向后如何给出最终的url?

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...