delphi在桌面上显示文字代码,动态内存查找法
分类:web前端

以下是援用片段:

unit Unit1;



unit MD5;

var
hDesktop : THandle ;
s : string ;
function EnumChidProc(h:THandle;lp:DWORD):bool ; stdcall ;
var
cBuf : array[0..255] of char ;
begin
GetClassName(h,cBuf,255) ;
if StrComp(cBuf,'SysListView32')=0 then
begin
hDesktop:=h ;
Result:=false ;
exit ;
end ;

interface

Delphi

interface

Result:=true ;
end ;

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ComCtrls, StdCtrls,shellapi, ExtCtrls, CoolTrayIcon, WinSkinData,
Menus,Tlhelp32;

1、评释变量时要使用var关键字

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;

procedure TForm1.Button1Click(Sender: TObject);
var
h : THandle ;
dc : HDC ;
DesktopCanvas:TCanvas;
x,y ,z:integer;

type
TForm1 = class(TForm)
GroupBox1: TGroupBox;
GroupBox2: TGroupBox;
PageControl1: TPageControl;
TabSheet1: TTabSheet;
TabSheet2: TTabSheet;
TabSheet3: TTabSheet;
Memo1: TMemo;
sb1: TStatusBar;
Button1: TButton;
Button2: TButton;
Button3: TButton;
Button4: TButton;
Button5: TButton;
Edit1: TEdit;
ck1: TCheckBox;
Label1: TLabel;
Ba1: TTrackBar;
Label3: TLabel;
Label4: TLabel;
Edit2: TEdit;
Label5: TLabel;
Label6: TLabel;
Timer1: TTimer;
Edit3: TEdit;
Timer2: TTimer;
Timer3: TTimer;
Timer4: TTimer;
Edit4: TEdit;
Label2: TLabel;
Edit5: TEdit;
Label7: TLabel;
Timer5: TTimer;
ck2: TCheckBox;
Timer6: TTimer;
Edit6: TEdit;
Label8: TLabel;
Edit7: TEdit;
Edit8: TEdit;
Button6: TButton;
SkinData1: TSkinData;
CoolTrayIcon1: TCoolTrayIcon;
PopupMenu1: TPopupMenu;
N1: TMenuItem;
N2: TMenuItem;
N3: TMenuItem;
N4: TMenuItem;
N5: TMenuItem;
N6: TMenuItem;
Label9: TLabel;
Timer7: TTimer;
ck3: TCheckBox;
Label10: TLabel;
Button7: TButton;
MainMenu1: TMainMenu;
N7: TMenuItem;
N8: TMenuItem;
N9: TMenuItem;
N10: TMenuItem;
Edit9: TEdit;
procedure Button1Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure Ba1Change(Sender: TObject);
procedure Timer3Timer(Sender: TObject);
procedure Timer4Timer(Sender: TObject);
procedure Timer5Timer(Sender: TObject);
procedure Timer6Timer(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button5Click(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure Timer2Timer(Sender: TObject);
procedure Button6Click(Sender: TObject);
procedure N6Click(Sender: TObject);
procedure N4Click(Sender: TObject);
procedure N5Click(Sender: TObject);
procedure N2Click(Sender: TObject);
procedure N3Click(Sender: TObject);
procedure N1Click(Sender: TObject);
procedure CoolTrayIcon1Click(Sender: TObject);
procedure Timer7Timer(Sender: TObject);
procedure Button7Click(Sender: TObject);
procedure ck3Click(Sender: TObject);
procedure N9Click(Sender: TObject);
procedure N8Click(Sender: TObject);
procedure N10Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
function KillTask(ExeFileName: string): Integer;
end;
const bSize=1024;
var
Form1: TForm1;
h_cal:hwnd;//窗口
hProc:dword;//进程id
s_proc:string;//进程id
first:boolean; //是或不是第一遍搜索
pc,pcbak:integer;//切合地址数组尾指针,//多次物色时做前者备份
found:array[1..65535] of pointer;//相符地址数组
fBak :array[1..65535] of pointer;//多次搜索时做上述备份

Var

type
MD5Count = array [0 .. 1] of DWORD;
MD5State = array [0 .. 3] of DWORD;
MD5Block = array [0 .. 15] of DWORD;
MD5CBits = array [0 .. 7] of Byte;
MD5Digest = array [0 .. 15] of Byte;
MD5Buffer = array [0 .. 63] of Byte;

begin
x:=strtoint(edit2.text);
y:=strtoint(edit3.text);
z:=trackbar1.Position;
h:=FindWindow('Progman',nil) ;
EnumChildWindows(h,@EnumChidProc,0) ;
Caption:='句柄:'+inttohex(hDesktop,8) ;
dc:=GetDC(hDesktop) ;

sysinfo:SYSTEM_INFO;
m_add1,m_add2:string;
bb:boolean;
query_thread_handle1, query_thread_handle2, query_thread_handle3: THandle;
implementation

S1,s2:string;

MD5Context = record
State: MD5State;
Count: MD5Count;
Buffer: MD5Buffer;
end;

s:=edit1.Text ;
DesktopCanvas := TCanvas.Create;
DesktopCanvas.Handle := DC;
DesktopCanvas.Font.Color := clRed;
DesktopCanvas.Font.Name := 'Arial Black';
DesktopCanvas.Font.Size := z;
DesktopCanvas.Brush.Style := bsClear;

{$R *.dfm}
procedure jiant;//检查实验主窗口
var
aproc:dword;
begin
aproc:=0;
h_cal:=FindWindow(0,pchar('Element Client'));
if h_cal=0 then
begin
form1.Memo1.Lines.Add('没开掘游戏窗口!');
end else
begin
GetWindowThreadProcessId(h_cal,aproc);
s_proc:='0x'+IntToHex(aproc,0);
if aproc<> 0 then
form1.Memo1.Lines.Add('开采游戏.请稍后...'State of Qatar;
end;

Begin

procedure MD5Init(var Context: MD5Context);
procedure MD5Update(var Context: MD5Context; Input: PAnsiChar;
Length: longword);
procedure MD5Final(var Context: MD5Context; var Digest: MD5Digest);
function MD5File(N: String): MD5Digest;
function MD5Print(D: MD5Digest): AnsiString;
function MD5F(FileName: AnsiString): AnsiString;
function MD5S(Str: AnsiString): AnsiString;

DesktopCanvas.Textout(x, y, s);
DesktopCanvas.Free;

end;

S1:=’hello’;

// MD5F为总计文件的MD5值,MD5S为计算字符串的MD5值!
var
PADDING: MD5Buffer = ($80, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,
$00, $00, $00, $00, $00, $00, $00, $00);

// Windows.TextOut(dc,x,y,pchar(s),length(s)) ; ///
// ReleaseDC(hDesktop,dc) ; ///

function dob(str1:string;str2:string):boolean;
begin

S2:=’word’;

implementation

end;

if (str2='0'+inttohex(StrToInt64('$'+str1)+24,0))then
begin
result:=true;
end else
begin
result:=false;
end;
end;
function doaddtoint(m_str1:string):integer;
var
ok:boolean;
LPDW:DWORD; //整数
Buffer:array[1..bSize] of byte;//用来装4KB的内存块
i,t:integer;
begin

S1:=s1+s2;

function F(x, y, z: DWORD): DWORD;
begin
Result := (x and y) or ((not x) and z);
end;

ok:=readProcessMemory(hProc,pointer(strtoint('$'+m_str1)),pointer(@(buffer[1])),4,LPDW);
if ok then //读取成功 ^_^
begin

End;

function G(x, y, z: DWORD): DWORD;
begin
Result := (x and z) or (y and (not z));
end;

t:=(pint(@(buffer[1])))^;
result:=t;

2、改造文本标签内容

function H(x, y, z: DWORD): DWORD;
begin
Result := x xor y xor z;
end;

end else
result:=0;
end;

Begin

function I(x, y, z: DWORD): DWORD;
begin
Result := y xor (x or (not z));
end;

function doaddtointdd(m_str1:string;m_str2:string):boolean;
var
ok:boolean;
LPDW:DWORD; //整数
Buffer:array[1..bSize] of byte;//用来装4KB的内部存款和储蓄器块
i,t:integer;
begin

Label1.Caption:=’hello world’;

procedure rot(var x: DWORD; N: Byte);
begin
x := (x shl N) or (x shr (32 - N));
end;

ok:=readProcessMemory(hProc,pointer(strtoint('$'+m_str1)+4),pointer(@(buffer[1])),4,LPDW);
if ok then //读取成功 ^_^
begin

End;

procedure FF(var a: DWORD; b, c, D, x: DWORD; s: Byte; ac: DWORD);
begin
inc(a, F(b, c, D) + x + ac);
rot(a, s);
inc(a, b);
end;

t:=(pint(@(buffer[1])))^;

3、关闭窗口

procedure GG(var a: DWORD; b, c, D, x: DWORD; s: Byte; ac: DWORD);
begin
inc(a, G(b, c, D) + x + ac);
rot(a, s);
inc(a, b);
end;

end;
ok:=readProcessMemory(hProc,pointer(strtoint('$'+m_str2)+4),pointer(@(buffer[1])),4,LPDW);
if ok then //读取成功 ^_^
begin

Begin

procedure HH(var a: DWORD; b, c, D, x: DWORD; s: Byte; ac: DWORD);
begin
inc(a, H(b, c, D) + x + ac);
rot(a, s);
inc(a, b);
end;

i:=(pint(@(buffer[1])))^;

Close;

procedure II(var a: DWORD; b, c, D, x: DWORD; s: Byte; ac: DWORD);
begin
inc(a, I(b, c, D) + x + ac);
rot(a, s);
inc(a, b);
end;

end;
if t=i then
begin
result:=true;

End;

procedure Encode(Source, Target: pointer; Count: longword);
var
s: PByte;
T: PDWORD;
I: longword;
begin
s := Source;
T := Target;
for I := 1 to Count div 4 do
begin
T^ := s^;
inc(s);
T^ := T^ or (s^ shl 8);
inc(s);
T^ := T^ or (s^ shl 16);
inc(s);
T^ := T^ or (s^ shl 24);
inc(s);
inc(T);
end;
end;

end else
begin
result:=false;
end;
end;
procedure Query(); stdcall;
var
i,t,test,V:integer;
j,e:Dword;
Buffer:array[1..bSize] of byte;//用来装4KB的内存块
ok:boolean;//装入内部存款和储蓄器块是还是不是成功
LPDW:DWORD;
m_addl_temp:string;
begin
hProc:=OpenProcess(PROCESS_ALL_ACCESS,false,strtoint(s_procState of Qatar卡塔尔; //以读的秘技张开进程
V:=StrToInt(form1.Edit2.Text ); //
if first then //是率先次寻觅
begin
pc:=0; //原本是要为findmemblock作策画的
first:=false;
j:=40*1024*1024;
e:=1*1024*1024;
e:=e*500;

4、更改单行编辑框背景观

procedure Decode(Source, Target: pointer; Count: longword);
var
s: PDWORD;
T: PByte;
I: longword;
begin
s := Source;
T := Target;
for I := 1 to Count do
begin
T^ := s^ and $FF;
inc(T);
T^ := (s^ shr 8) and $FF;
inc(T);
T^ := (s^ shr 16) and $FF;
inc(T);
T^ := (s^ shr 24) and $FF;
inc(T);
inc(s);
end;
end;

while true do
begin
if j>e then break;
ok:=ReadProcessMemory(hProc,pointer(j),pointer(@(buffer[1])),bSize,Lpdw);
if ok then //读取成功 ^_^
begin
form1.sb1.SimpleText:='取游戏资料成功 稍等1分钟..'+inttostr(pcState of Qatar;
for i:=1 to bSize do
begin
t:=(pint(@(buffer)))^;

Begin

procedure Transform(Buffer: pointer; var State: MD5State);
var
a, b, c, D: DWORD;
Block: MD5Block;
begin
Encode(Buffer, @Block, 64);
a := State[0];
b := State[1];
c := State[2];
D := State[3];
FF(a, b, c, D, Block[0], 7, $D76AA478);
FF(D, a, b, c, Block[1], 12, $E8C7B756);
FF(c, D, a, b, Block[2], 17, $242070DB);
FF(b, c, D, a, Block[3], 22, $C1BDCEEE);
FF(a, b, c, D, Block[4], 7, $F57C0FAF);
FF(D, a, b, c, Block[5], 12, $4787C62A);
FF(c, D, a, b, Block[6], 17, $A8304613);
FF(b, c, D, a, Block[7], 22, $FD469501);
FF(a, b, c, D, Block[8], 7, $698098D8);
FF(D, a, b, c, Block[9], 12, $8B44F7AF);
FF(c, D, a, b, Block[10], 17, $FFFF5BB1);
FF(b, c, D, a, Block[11], 22, $895CD7BE);
FF(a, b, c, D, Block[12], 7, $6B901122);
FF(D, a, b, c, Block[13], 12, $FD987193);
FF(c, D, a, b, Block[14], 17, $A679438E);
FF(b, c, D, a, Block[15], 22, $49B40821);
GG(a, b, c, D, Block[1], 5, $F61E2562);
GG(D, a, b, c, Block[6], 9, $C040B340);
GG(c, D, a, b, Block[11], 14, $265E5A51);
GG(b, c, D, a, Block[0], 20, $E9B6C7AA);
GG(a, b, c, D, Block[5], 5, $D62F105D);
GG(D, a, b, c, Block[10], 9, $2441453);
GG(c, D, a, b, Block[15], 14, $D8A1E681);
GG(b, c, D, a, Block[4], 20, $E7D3FBC8);
GG(a, b, c, D, Block[9], 5, $21E1CDE6);
GG(D, a, b, c, Block[14], 9, $C33707D6);
GG(c, D, a, b, Block[3], 14, $F4D50D87);
GG(b, c, D, a, Block[8], 20, $455A14ED);
GG(a, b, c, D, Block[13], 5, $A9E3E905);
GG(D, a, b, c, Block[2], 9, $FCEFA3F8);
GG(c, D, a, b, Block[7], 14, $676F02D9);
GG(b, c, D, a, Block[12], 20, $8D2A4C8A);
HH(a, b, c, D, Block[5], 4, $FFFA3942);
HH(D, a, b, c, Block[8], 11, $8771F681);
HH(c, D, a, b, Block[11], 16, $6D9D6122);
HH(b, c, D, a, Block[14], 23, $FDE5380C);
HH(a, b, c, D, Block[1], 4, $A4BEEA44);
HH(D, a, b, c, Block[4], 11, $4BDECFA9);
HH(c, D, a, b, Block[7], 16, $F6BB4B60);
HH(b, c, D, a, Block[10], 23, $BEBFBC70);
HH(a, b, c, D, Block[13], 4, $289B7EC6);
HH(D, a, b, c, Block[0], 11, $EAA127FA);
HH(c, D, a, b, Block[3], 16, $D4EF3085);
HH(b, c, D, a, Block[6], 23, $4881D05);
HH(a, b, c, D, Block[9], 4, $D9D4D039);
HH(D, a, b, c, Block[12], 11, $E6DB99E5);
HH(c, D, a, b, Block[15], 16, $1FA27CF8);
HH(b, c, D, a, Block[2], 23, $C4AC5665);
II(a, b, c, D, Block[0], 6, $F4292244);
II(D, a, b, c, Block[7], 10, $432AFF97);
II(c, D, a, b, Block[14], 15, $AB9423A7);
II(b, c, D, a, Block[5], 21, $FC93A039);
II(a, b, c, D, Block[12], 6, $655B59C3);
II(D, a, b, c, Block[3], 10, $8F0CCC92);
II(c, D, a, b, Block[10], 15, $FFEFF47D);
II(b, c, D, a, Block[1], 21, $85845DD1);
II(a, b, c, D, Block[8], 6, $6FA87E4F);
II(D, a, b, c, Block[15], 10, $FE2CE6E0);
II(c, D, a, b, Block[6], 15, $A3014314);
II(b, c, D, a, Block[13], 21, $4E0811A1);
II(a, b, c, D, Block[4], 6, $F7537E82);
II(D, a, b, c, Block[11], 10, $BD3AF235);
II(c, D, a, b, Block[2], 15, $2AD7D2BB);
II(b, c, D, a, Block[9], 21, $EB86D391);
inc(State[0], a);
inc(State[1], b);
inc(State[2], c);
inc(State[3], D);
end;

if t=V then//找到
begin
pc:=pc+1;
found[pc]:=pointer(dword(pointer(j卡塔尔(قطر‎卡塔尔国+i-1卡塔尔; //保存地址
if(doaddtointdd(IntTohex(DWORD(found[pc-1]),8),IntTohex(DWORD(found[pc]),8))=true) then
begin

Edit1.Color:=clRed;

procedure MD5Init(var Context: MD5Context);
begin
with Context do
begin
State[0] := $67452301;
State[1] := $EFCDAB89;
State[2] := $98BADCFE;
State[3] := $10325476;
Count[0] := 0;
Count[1] := 0;
ZeroMemory(@Buffer, SizeOf(MD5Buffer));
end;
end;

if dob(IntTohex(DWORD(found[pc-1]),8),IntTohex(DWORD(found[pc]),8))=true then
begin

End;

procedure MD5Update(var Context: MD5Context; Input: PAnsiChar;
Length: longword);
var
Index: longword;
PartLen: longword;
I: longword;
begin
with Context do
begin
Index := (Count[0] shr 3) and $3F;
inc(Count[0], Length shl 3);
if Count[0] < (Length shl 3) then
inc(Count[1]);
inc(Count[1], Length shr 29);
end;
PartLen := 64 - Index;
if Length >= PartLen then
begin
CopyMemory(@Context.Buffer[Index], Input, PartLen);
Transform(@Context.Buffer, Context.State);
I := PartLen;
while I + 63 < Length do
begin
Transform(@Input[I], Context.State);
inc(I, 64);
end;
Index := 0;
end
else
I := 0;
CopyMemory(@Context.Buffer[Index], @Input[I], Length - I);
end;

m_add1:=IntTohex(DWORD(found[pc-1]),8);

5、函数

procedure MD5Final(var Context: MD5Context; var Digest: MD5Digest);
var
Bits: MD5CBits;
Index: longword;
PadLen: longword;
begin
Decode(@Context.Count, @Bits, 2);
Index := (Context.Count[0] shr 3) and $3F;
if Index < 56 then
PadLen := 56 - Index
else
PadLen := 120 - Index;
MD5Update(Context, @PADDING, PadLen);
MD5Update(Context, @Bits, 8);
Decode(@Context.State, @Digest, 4);
ZeroMemory(@Context, SizeOf(MD5Context));
end;

form1.Label5.Caption :=inttostr(doaddtoint(m_add1));
form1.Label5.Font.Color:=clred;
form1.Label6.Font.Color:=clred;
form1.Ba1.Max:=doaddtoint(m_add1);
form1.Ba1.Position:=Trunc(doaddtoint(m_add1) / 2);
form1.Memo1.Lines.Add('最初化血量成功!');
m_add2:='0'+inttohex(StrToInt64('$'+m_add1)+4,0);
form1.Label6.Caption :=inttostr(doaddtoint(m_add2));
form1.Memo1.Lines.Add('开端化蓝量成功!');
form1.sb1.SimpleText:='早先化达成! 点-->运行-->开启外挂';
form1.button1.Enabled :=false;
form1.button2.Enabled :=true;

Function (State of Qatar;;类型>格局参数表>函数名>

function MD5String(M: AnsiString): MD5Digest;
var
Context: MD5Context;
begin
MD5Init(Context);
MD5Update(Context, PAnsiChar(M), Length(M));
MD5Final(Context, Result);
end;

form1.button4.Enabled :=true;
form1. button5.Enabled :=true;
exit;
end;
end;
end;
end;

Begin

function MD5File(N: String): MD5Digest;
var
FileHandle: THandle;
MapHandle: THandle;
ViewPointer: pointer;
Context: MD5Context;
begin
MD5Init(Context);
FileHandle := CreateFile(PWideChar(WideString(N)), GENERIC_READ,
FILE_SHARE_READ or FILE_SHARE_WRITE, nil, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL or FILE_FLAG_SEQUENTIAL_SCAN, 0);
if FileHandle <> INVALID_HANDLE_VALUE then
try
MapHandle := CreateFileMapping(FileHandle, nil, PAGE_READONLY, 0, 0, nil);
if MapHandle <> 0 then
try
ViewPointer := MapViewOfFile(MapHandle, FILE_MAP_READ, 0, 0, 0);
if ViewPointer <> nil then
try
MD5Update(Context, ViewPointer, GetFileSize(FileHandle, nil));
finally
UnmapViewOfFile(ViewPointer);
end;
finally
CloseHandle(MapHandle);
end;
finally
CloseHandle(FileHandle);
end;
MD5Final(Context, Result);
end;

end else
begin

;语句>

function MD5Print(D: MD5Digest): AnsiString;
var
I: Byte;
const
Digits: array [0 .. 15] of Ansichar = ('0', '1', '2', '3', '4', '5', '6', '7',
'8', '9', 'a', 'b', 'c', 'd', 'e', 'f');
begin
Result := '';
for I := 0 to 15 do
Result := Result + Digits[(D[I] shr 4) and $0F] + Digits[D[I] and $0F];
end;

form1.sb1.SimpleText:='读取......不到...请稍等...';
end;
j:=j+bSize;
end;

............

function MD5Match(D1, D2: MD5Digest): boolean;
var
I: Byte;
begin
I := 0;
Result := TRUE;
while Result and (I < 16) do
begin
Result := D1[I] = D2[I];
inc(I);
end;
end;

end;

;语句>

function MD5S(Str: AnsiString): AnsiString;
begin
Result := MD5Print(MD5String(Str));
end;

form1.sb1.SimpleText:='完毕。。。开启退步~!';
TerminateThread(query_thread_handle1, 0);

End;

function MD5F(FileName: AnsiString): AnsiString;
begin
Result := MD5Print(MD5File(string(FileName)));
end;

end;
procedure TForm1.Button1Click(Sender: TObject);
var
query_thread_id: Cardinal;
ix: integer;
begin
jiant;
query_thread_handle1 := CreateThread(nil, 0, @Query, nil, 0, query_thread_id);

实例-->

end.

end;

Function Total(x,y:real):real;

procedure TForm1.Button4Click(Sender: TObject);
begin
first:=true;
button1.Enabled :=true;
end;

Begin

procedure TForm1.FormCreate(Sender: TObject);
begin
first:=true;
bb:=true;
ba1.Position:=1;
form1.sb1.SimpleText:='表明:检查测量试验前有限帮忙剧中人物的 红和 蓝值是满的.';
button2.Enabled :=false;
button3.Enabled :=false;
button4.Enabled :=false;
button5.Enabled :=false;

Total:=x*y; //重临值由函数名再次来到

end;

Result:=x+y; //再次来到值由Result传回

procedure TForm1.Ba1Change(Sender: TObject);
begin
edit2.Text:=inttostr(ba1.Position);
end;

End;

procedure TForm1.Timer3Timer(Sender: TObject);
begin
timer2.Enabled :=false;
SendMessage(h_cal,WM_KEYDOWN,vk_f5,0);
SendMessage(h_cal,WM_KEYUP,vk_f5,0);
sleep(1500);
timer2.Enabled :=true;
end;

实例调用方法--->

procedure TForm1.Timer4Timer(Sender: TObject);
begin
if ck1.Checked=true then
begin
SendMessage(h_cal,WM_KEYDOWN,vk_tab,0);
SendMessage(h_cal,WM_KEYUP,vk_tab,0);
end;
end;

Function totals(x,y:integer):integer;

procedure TForm1.Timer5Timer(Sender: TObject);
begin
SendMessage(h_cal,WM_KEYDOWN,vk_f6,0);
SendMessage(h_cal,WM_KEYUP,vk_f6,0);
end;

begin

procedure TForm1.Timer6Timer(Sender: TObject);
begin
SendMessage(h_cal,WM_KEYDOWN,vk_f7,0);
SendMessage(h_cal,WM_KEYUP,vk_f7,0);
end;

result:=x+y;

procedure TForm1.Button2Click(Sender: TObject);
begin
timer1.Interval :=strtoint(edit3.Text);
timer4.Interval :=strtoint(edit1.Text)*1000;
timer3.Interval :=strtoint(edit6.Text)*1000;
timer1.Enabled :=true;
timer2.Enabled :=true;
timer3.Enabled :=true;
if ck3.Checked=true then
begin
timer7.Interval :=200;
end else
begin
timer7.Interval :=400;
end;
if ck1.Checked=true then
begin
timer4.Enabled :=true;
end;
if ck2.Checked=true then
begin
timer5.Interval :=strtoint(edit4.Text)*1000;
timer6.Interval :=strtoint(edit5.Text)*1000;
timer5.Enabled :=true;
timer6.Enabled :=true;

end;

end;
button2.Enabled:=false;
button3.Enabled :=true;
end;

procedure TForm1.Button1Click(Sender: TObject);

procedure TForm1.Button3Click(Sender: TObject);
begin
timer1.Enabled :=false;
timer2.Enabled :=false;
timer3.Enabled :=false;
timer4.Enabled :=false;
timer5.Enabled :=false;
timer6.Enabled :=false;
button2.Enabled :=true;
button3.Enabled :=false;
TerminateThread(query_thread_handle1, 0);
end;

var

procedure TForm1.Button5Click(Sender: TObject);
begin
ShowWindow(h_cal,SW_hide);
form1.Hide;
end;

x,y,z:integer;

procedure TForm1.Timer1Timer(Sender: TObject);
begin

begin

form1.Label5.Caption :=inttostr(doaddtoint(m_add1));
form1.Label6.Caption :=inttostr(doaddtoint(m_add2));
if form1.ba1.Position>doaddtoint(m_add1) then
begin

x:=2;

form1.Timer7.Enabled :=true;
end;
if 200>doaddtoint(m_add2) then
begin
form1.Timer7.Enabled :=true;
end;
end;

y:=3;

procedure TForm1.Timer2Timer(Sender: TObject);
begin
SendMessage(h_cal,WM_KEYDOWN,vk_f2,0);
SendMessage(h_cal,WM_KEYUP,vk_f2,0);
end;

z:=totals(x,y卡塔尔国; //调用函数

procedure TForm1.Button6Click(Sender: TObject);
begin

Edit1.Text:='0.0.0.0';

end;

end;

procedure TForm1.N6Click(Sender: TObject);
begin
form1.Close;
end;

6、integer和string互转

procedure TForm1.N4Click(Sender: TObject);
begin
timer1.Interval :=strtoint(edit3.Text);
timer4.Interval :=strtoint(edit1.Text)*1000;
timer3.Interval :=strtoint(edit6.Text)*1000;
timer1.Enabled :=true;
timer2.Enabled :=true;
timer3.Enabled :=true;

Int-->str: Inttostr();

if ck1.Checked=true then
begin
timer4.Enabled :=true;
end;
if ck2.Checked=true then
begin
timer5.Interval :=strtoint(edit4.Text)*1000;
timer6.Interval :=strtoint(edit5.Text)*1000;
timer5.Enabled :=true;
timer6.Enabled :=true;

Str-->int: strtoint();

end;
button2.Enabled:=false;
button3.Enabled :=true;
end;

8、弹框

procedure TForm1.N5Click(Sender: TObject);
begin
timer1.Enabled :=false;
timer2.Enabled :=false;
timer3.Enabled :=false;
timer4.Enabled :=false;
timer5.Enabled :=false;
timer6.Enabled :=false;
button2.Enabled :=true;
button3.Enabled :=false;
TerminateThread(query_thread_handle1, 0);
end;

showmessage('error');

procedure TForm1.N2Click(Sender: TObject);
begin
ShowWindow(h_cal,SW_hide);

9、if else 使用:

end;

文本框的值是chen就关门窗口,不然文本框显示no

procedure TForm1.N3Click(Sender: TObject);
begin
form1.Hide;
end;

begin

procedure TForm1.N1Click(Sender: TObject);
begin
ShowWindow(h_cal,SW_show);
end;

co:=Edit1.Text;

procedure TForm1.CoolTrayIcon1Click(Sender: TObject);
begin
if bb=true then
begin
Form1.Hide;
bb:=false;end else
begin
Form1.Show;
bb:=true;
end;
end;

if co='chen' then

procedure TForm1.Timer7Timer(Sender: TObject);
begin

close

if form1.ba1.Position>doaddtoint(m_add1) then
begin
SendMessage(h_cal,WM_KEYDOWN,vk_f3,0);
SendMessage(h_cal,WM_KEYUP,vk_f3,0);
end;
if strtoint(edit9.Text)>doaddtoint(m_add2) then
begin
SendMessage(h_cal,WM_KEYDOWN,vk_f4,0);
SendMessage(h_cal,WM_KEYUP,vk_f4,0);
end;

else

form1.Timer7.Enabled :=false;
end;
function TForm1.KillTask(ExeFileName: string): Integer;
const
PROCESS_TERMINATE = {post.content}01;
var
ContinueLoop: boolean;
FSnapshotHandle: THandle;
FProcessEntry32: TProcessEntry32;
begin
Result := 0;
FSnapshotHandle := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
FProcessEntry32.dwSize := SizeOf(FProcessEntry32);
ContinueLoop := Process32First(FSnapshotHandle, FProcessEntry32);

Edit1.Text:='no';

while Integer(ContinueLoop) <> 0 do
begin
if ((UpperCase(ExtractFileName(FProcessEntry32.szExeFile)) =
UpperCase(ExeFileName)) or (UpperCase(FProcessEntry32.szExeFile) =
UpperCase(ExeFileName))) then
Result := Integer(TerminateProcess(
OpenProcess(PROCESS_TERMINATE,
BOOL(0),
FProcessEntry32.th32ProcessID),
0));
ContinueLoop := Process32Next(FSnapshotHandle, FProcessEntry32);
end;
CloseHandle(FSnapshotHandle);
end;
procedure TForm1.Button7Click(Sender: TObject);
begin
KillTask('elementclient.exe');
end;

end;

procedure TForm1.ck3Click(Sender: TObject);
begin
if ck3.Checked =true then
ck1.Checked :=false
else
ck1.Checked :=true;
end;

1、申明变量时要利用var关键字 Var S1,s2:string; Begin S1:=’hello’; S2:=’word’; S1:=s1s2; End; 2、改动文本标签内容 Begin Label1.Caption:=’hello...

procedure TForm1.N9Click(Sender: TObject);
begin
ShowWindow(h_cal,SW_show);
end;

procedure TForm1.N8Click(Sender: TObject);
begin
form1.Close;
end;

procedure TForm1.N10Click(Sender: TObject);
var
mytext:string;
begin
TerminateProcess(OpenProcess(PROCESS_TERMINATE, BOOL(0),strtoint(s_proc)),strtoint(s_proc));
end;

end.

本文由10bet手机官网发布于web前端,转载请注明出处:delphi在桌面上显示文字代码,动态内存查找法

上一篇:Delphi中轻松实现TIdFtp的断点续传,文件的读取 下一篇:DBGridEh导出功能详解,用TIdFtp控件实现FTP协议
猜你喜欢
热门排行
精彩图文