吾爱破解 - 52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 6102|回复: 2
收起左侧

[其他转载] 转delphi版 随机窗口类名

[复制链接]
Tale 发表于 2010-2-5 11:01
unit Unit1;

interface

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

type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
procedure FormShow(Sender: TObject);
private
procedure CreateParams(var Parames:TCreateParams);override;
Function Randstring():string;
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}


Function tform1.Randstring():string;
var
i,t,n:Integer;
c,s:string;
begin
repeat
randomize();
n:=Random(16);
until (n>=6) and (n<=16) ;
for i:=0 to n do
begin
if i=0 then t:=Random(25)+10 else t:=Random(35);
case t of
0 :c:='0';
1 :c:='1';
2 :c:='2';
3 :c:='3';
4 :c:='4';
5 :c:='5';
6 :c:='6';
7 :c:='7';
8 :c:='8';
9 :c:='9';
10:c:='a';
11:c:='b';
12:c:='c';
13:c:='d';
14:c:='e';
15:c:='f';
16:c:='g';
17:c:='h';
18:c:='i';
19:c:='j';
20:c:='k';
21:c:='l';
22:c:='m';
23:c:='n';
24:c:='o';
25:c:='p';
26:c:='q';
27:c:='r';
28:c:='s';
29:c:='t';
30:c:='u';
31:c:='v';
32:c:='w';
33:c:='x';
34:c:='y';
35:c:='z';
end;
s:=s+c;
end;
Result:=s;

end;


procedure TForm1.CreateParams(var Parames: TCreateParams);
var
t:string;
i:Integer;
begin
inherited CreateParams(Parames);
t:= Randstring() ;
for i:=1 to Length(t) do
begin
Parames.WinClassName:=t;
end;

end;

procedure TForm1.Button1Click(Sender: TObject);

var
Name:array[0..MAXBYTE] of char;
begin
GetClassName(Handle,Name,255);
ShowMessage(Name);
end;


procedure TForm1.FormShow(Sender: TObject);
begin
form1.Caption:=Randstring();
end;

end.

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

hixiaosheng 发表于 2010-2-5 11:23
学习了,不错··
Squn 发表于 2010-2-8 15:55
unit Unit1;

interface

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

type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
procedure FormShow(Sender: TObject);
private
procedure CreateParams(var Parames:TCreateParams);override;
Function Randstring():string;
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}


Function tform1.Randstring():string;
var
i,t,n:Integer;
c,s:string;
begin
repeat
randomize();
n:=Random(16);
until (n>=6) and (n<=16) ;
for i:=0 to n do
begin
if i=0 then t:=Random(25)+10 else t:=Random(35);
case t of
0 :c:='0';
1 :c:='1';
2 :c:='2';
3 :c:='3';
4 :c:='4';
5 :c:='5';
6 :c:='6';
7 :c:='7';
8 :c:='8';
9 :c:='9';
10:c:='a';
11:c:='b';
12:c:='c';
13:c:='d';
14:c:='e';
15:c:='f';
16:c:='g';
17:c:='h';
18:c:='i';
19:c:='j';
20:c:='k';
21:c:='l';
22:c:='m';
23:c:='n';
24:c:='o';
25:c:='p';
26:c:='q';
27:c:='r';
28:c:='s';
29:c:='t';
30:c:='u';
31:c:='v';
32:c:='w';
33:c:='x';
34:c:='y';
35:c:='z';
end;
s:=s+c;
end;
Result:=s;

end;


procedure TForm1.CreateParams(var Parames: TCreateParams);
var
t:string;
i:Integer;
begin
inherited CreateParams(Parames);
t:= Randstring() ;
for i:=1 to Length(t) do
begin
Parames.WinClassName:=t;
end;

end;

procedure TForm1.Button1Click(Sender: TObject);

var
Name:array[0..MAXBYTE] of char;
begin
GetClassName(Handle,Name,255);
ShowMessage(Name);
end;


procedure TForm1.FormShow(Sender: TObject);
begin
form1.Caption:=Randstring();
end;

end.


上个色~~~
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则

返回列表

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-11-17 04:25

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表