?? unit1.pas
字號:
unit Unit1;
interface
uses
Windows, Messages, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ComCtrls, ExtCtrls,zlib;
type
iReplace = procedure (Text: PChar);
TForm1 = class(TForm)
PageControl1: TPageControl;
TabSheet1: TTabSheet;
Label1: TLabel;
Label2: TLabel;
memo1: TMemo;
Button1: TButton;
Edit1: TEdit;
TabSheet2: TTabSheet;
Panel1: TPanel;
Edit2: TEdit;
Button2: TButton;
od: TOpenDialog;
Memo2: TMemo;
TabSheet3: TTabSheet;
GroupBox1: TGroupBox;
Memo3: TMemo;
procedure Button1Click(Sender: TObject);
procedure getowner(owner:integer);
procedure Button2Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
ownerapp:integer;
implementation
{$R *.dfm}
//Gets the EXE owner
procedure tform1.getowner(owner:integer);
begin
ownerapp:=owner;
end;
procedure TForm1.Button1Click(Sender: TObject);
var serverdllname:pchar;
begin
//this is the server plugin dll name:
serverdllname:='syscomp.dll';
//here you tell the client what to send to server:
iReplace(GetProcAddress(OwnerApp, 'ReplaceText'))(pchar(serverdllname+';'+edit1.Text));
end;
procedure DecompressStream(inpStream, outStream: TStream);
var
InpBuf, OutBuf: Pointer;
OutBytes, sz: Integer;
begin
InpBuf := nil;
OutBuf := nil;
sz := inpStream.Size - inpStream.Position;
if sz > 0 then
try
GetMem(InpBuf, sz);
inpStream.Read(InpBuf^, sz);
DecompressBuf(InpBuf, sz, 0, OutBuf, OutBytes);
outStream.Write(OutBuf^, OutBytes);
finally
if InpBuf <> nil then FreeMem(InpBuf);
if OutBuf <> nil then FreeMem(OutBuf);
end;
outStream.Position := 0;
end;
//---------------------------------------------------------INTTOSTR
function inttostr(i:longint):string;
begin
str(i,result);
end;
function Getfilesize(fn:string):string;
var
f:file of byte;
begin
assignfile(f,fn);
reset(f);
result := inttostr(filesize(f))+'bytes';
closefile(f);
end;
procedure TForm1.Button2Click(Sender: TObject);
var
ms1, ms2: TMemoryStream;
inF,outF:string;
begin
if od.execute then
begin
ms1 := TMemoryStream.Create;
try
ms2 := TMemoryStream.Create;
try
inF:= od.filename;
outF := copy(inF,1,length(inF)-2);
ms1.LoadFromFile(inF);
edit2.text := inf;
memo2.lines.add('Infile: '+inf+' ... '+GetFilesize(inf));
DecompressStream(ms1, ms2);
ms2.savetofile(outF);
memo2.lines.add('Outfile: '+outf+' ... '+GetFilesize(Outf));
finally
ms1.Free;
end;
finally
ms2.Free;
end;
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
SetWindowPos(Handle, // handle to window
HWND_TOPMOST, // placement-order handle {*}
Left, // horizontal position
Top, // vertical position
Width,
Height,
// window-positioning options
SWP_NOACTIVATE or SWP_NOMOVE or SWP_NOSIZE);
end;
end.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -