⼀起解剖灰鸽⼦VIP1.2源码从⼯程⽂件开始分析:
program H_Client;
uses
Forms,
windows,
messages,
Classes,
Main in 'Main.pas' {HgzVip},
AboutUnit in 'AboutUnit.pas' {AboutForm},
UpIp in 'UpIp.pas' {UpIpDate},
SysInf in 'SysInf.pas' {SysShezhi},
ShowPic in 'ShowPic.pas' {ShowPm},
Scanover in 'Scanover.pas' {Sjiegou},
Splash in 'Splash.pas' {启动时的logo窗⼝},
RegEditUnit in 'RegEditUnit.pas' {RegEdit},
RegHexEdit in 'RegHexEdit.pas' {RegHex},
ConfigServerUnit in 'ConfigServerUnit.pas' {ConfigServer},
NewxpSer in 'NewxpSer.pas' {NewxpServer},
FtpUpUnit1 in 'FtpUpUnit1.pas' {FtpUp},
FtpDownUnit in 'FtpDownUnit.pas' {FTPDown},
ExeToolUnit in 'ExeToolUnit.pas' {ExeToolForm},
IconLibrary in 'icotool\IconLibrary.pas',
IconTools in 'icotool\IconTools.pas',
IconTypes in 'icotool\Icontypes.pas',
unitExIcon in 'icotool\unitExIcon.pas',
unitPEFile in 'icotool\unitPEFile.pas',
unitResourceDetails in 'icotool\unitResourceDetails.pas',
unitResourceGraphics in 'icotool\unitResourceGraphics.pas',
BmpToAviUnit in 'BmpToAviUnit.pas' {BmpToAviForm},
FTPServerUnit in 'FTPServerUnit.pas' {FTPServerForm},
DESCrypt in 'DESCrypt.pas',
LangFrm in 'Langmgr\LangFrm.pas',
LangMgr in 'Langmgr\LangMgr.pas',
LangObj in 'Langmgr\LangObj.pas';
{$R *.RES}
var
I:integer;
begin
Application.Initialize;
SplashForm:=TSplashForm.Create(Application);
SplashForm.Show;
ShowWindow(Application.Handle, SW_HIDE); //隐藏窗体
SplashForm.Update;
Application.Title := '⼩乐修改版 Vip 1.2';
SplashForm.Gauge1.Progress:=5;
SplashForm.Update;
Application.CreateForm(THgzVip, HgzVip);
SplashForm.Gauge1.Progress:=25;
SplashForm.Update;
Application.CreateForm(TConfigServer, ConfigServer);
SplashForm.Gauge1.Progress:=30;
SplashForm.Update;
Application.CreateForm(TNewxpServer, NewxpServer);
SplashForm.Gauge1.Progress:=40;
SplashForm.Update;
Application.CreateForm(TFtpUp, FtpUp);
SplashForm.Gauge1.Progress:=50;
SplashForm.Update;
Application.CreateForm(TFTPDown, FTPDown);
SplashForm.Gauge1.Progress:=60;
SplashForm.Update;
Application.CreateForm(TExeToolForm, ExeToolForm);
SplashForm.Gauge1.Progress:=70;
SplashForm.Update;
Application.CreateForm(TBmpToAviForm, BmpToAviForm);
Application.CreateForm(TFTPServerForm, FTPServerForm);
SplashForm.Gauge1.Progress:=80;//'加载登陆窗⼝...';
SplashForm.Update;
Application.CreateForm(TShowPm, ShowPm);
Application.CreateForm(TSjiegou, Sjiegou);
Application.CreateForm(TUpIpDate, UpIpDate);
Application.CreateForm(TSysShezhi, SysShezhi);
SplashForm.Gauge1.Progress:=95;//'加载登陆窗⼝...';
SplashForm.Update;
Application.CreateForm(TRegEdit, RegEdit);
Application.CreateForm(TRegHex, RegHex);
SplashForm.Gauge1.Progress:=100;//'加载登陆窗⼝...';
SplashForm.Update;
Application.ProcessMessages;
HgzVip.NoisReg:=Tr;
SplashForm.Free;
//Application.ShowMainForm :=tr;
Application.Run;
end.
⼀看就明⽩了,USES这⼀块,引⽤了很多源码(.pas)有的是窗体的有的没有窗体的,
然后beigin到end中间的内容
就创建logo窗⼝,就是运⾏鸽⼦的时候那个显⽰版本的界⾯,什么版权所有葛军之类的内容的那个界⾯。然后就是⽣成各个窗体,中间每完成⼀个都让LOGO窗⼝的进度条变化⼀下。
最后释放logo窗体,显⽰主窗体。
实际上主窗体就是 Application.CreateForm(THgzVip, HgzVip);⽣成的窗体HgzVip
--------------------------------------
整个过程看起来⾮常清晰。中间有⼀句
ShowWindow(Application.Handle, SW_HIDE);
使⽤这句⼀定要在前⾯ USES WINDOWS才可以
从英⽂的意义上来看应该是隐藏这个⼯程的窗体,但实际上新建了⼀个⼯程加上这句测试过,似乎不能隐藏⼯程的主窗体,也许是⼯程总是要打开⼀个窗体的吧。
---------------------------------------
实际上我删了这句ShowWindow(Application.Handle, SW_HIDE);  程序也能正常运⾏。
因为⾮主窗体⽣成的时候默认是关闭的。
但这句的作⽤什么呢?应该不会是多余的吧?
谁有更好的解释么?
⼩熊说:
Application.ShowMainForm :=false;
这个才是隐藏主窗体界⾯
⼩乐说:
谢谢熊哥指点,我也清楚
//Application.ShowMainForm :=tr;
是决定主窗体隐藏与否的
我的困惑在于ShowWindow(Application.Handle, SW_HIDE); //隐藏窗体究竟是隐藏什么东西的呢?是不是多余的呢?
接着看它的LOGO窗⼝ SplashForm的源码
应该思路也⾮常清晰,就是⼀个窗体上⾯有⼀个进度条然后就是⼀个图⽚
--------------------------
unit Splash;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, jpeg, ExtCtrls, StdCtrls, LangFrm, Gauges;
type
TSplashForm = class(TForm)
Image1: TImage;
Gauge1: TGauge;
procedure FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
private
{ Private declarations }
p lic
{ P lic declarations }
end;
var
SplashForm: TSplashForm;
implementation
{$R *.dfm}
procedure TSplashForm.FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if (Key = VK_F4) and (ssAlt in Shift) then Key := 0;
end;
end.
---------------------------
疑惑点:
if (Key = VK_F4) and (ssAlt in Shift) then Key := 0; 是⼲什么的呢?
FormKeyDown 是窗体事件,表⽰按下键盘触发的事件,估计这个是某个功能,触发按键盘的事件,
搜索了⼀下原来这句的作⽤是:
if (Key=VK_F4)and(ssAlt in shift) then {使系统键Alt+F4失效}
呵呵⼜学会了⼀点吧。。。。。
unit AboutUnit;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, Main, DynamicSkinForm, Buttons, SkinCtrls, SkinBoxCtrls,
SkinGrids, ExtCtrls,shellapi,DESCrypt, jpeg, IdGlobal, LangFrm;
type
TAboutForm = class(TLangForm)
Bevel1: TBevel;
Image1: TImage;
Label4: TspSkinStdLabel;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Button1: TspSkinButton;
DSF: TspDynamicSkinForm;
//⽪肤控件
//主要是⽪肤控件 DSF: TspDynamicSkinForm
//属性DSF.SkinHint 是指向HgzVip.spSkinHint1
//属性DSF.SkinData是指向HgzVip.spSkinData1
Image2: TImage;
procedure Button1Click(Sender: TObject);
procedure Label2Click(Sender: TObject);
procedure Label3Click(Sender: TObject);
procedure Label2MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure Label3MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure FormMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
private
免费分享源码的网址
{ Private declarations }
p lic
{ P lic declarations }
end;
var
AboutForm: TAboutForm;
keytp:string;
implementation
{$R *.DFM}
procedure TAboutForm.Button1Click(Sender: TObject);
begin
Close;
end;
//这两句是点击两个连接会打开IE,字符串是⽤DeCryptStr 解密的,我测试过⽤百度直接也能打开
//解密函数DeCryptStr() 在前⾯的引⽤的 DESCrypt ⾥。
//⼀开始,我不太明⽩他为什么要做成加密字串然后再做成解密呢,不是很多余么?后来想想忽然恍然⼤悟,哦原来是为了过滤掉他⾃⼰的⽹址,这样的话别⼈搜索字符串就替
换不掉他的⽹址和邮箱信息咯。真是太聪明了
procedure TAboutForm.Label2Click(Sender: TObject);
begin
ShellExecute(0, 'open', pchar(DeCryptStr('487D6CB4BADFCCE3314D70B78C37E4A19967A11A0A8FAA17',Head)), nil, nil, SW_SHOWMAXIMIZED);
/
/ShellExecute(0, 'open', pchar('www.baidu'), nil, nil, SW_SHOWMAXIMIZED);
end;
procedure TAboutForm.Label3Click(Sender: TObject);
begin
ShellExecute(0, 'open', pchar(DeCryptStr('BB47B76BEF00F0D316AF0B736236860EC89101DF0482D0975C7F285763EE94F9F56C1B69A1956EE040232466768FCAB4',Head)), nil, nil, SW_SHOW end;
//这段是设置⿏标放上去后字体颜⾊变换的
procedure TAboutForm.Label2MouseMove(Sender: TObject; Shift: TShiftState;
X, Y: Integer);
begin
Label2.Font.Color:=clRed;
end;
procedure TAboutForm.Label3MouseMove(Sender: TObject; Shift: TShiftState;
X, Y: Integer);
begin
Label3.Font.Color :=clRed;
end;
procedure TAboutForm.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
Label2.Font.Color :=clWindowText;
Label3.Font.Color :=clWindowText;
end;
//这段是葛军⽤来做藏记号⽤的,只要按住 ALT键输⼊ “HUIGEZI” 或者 “LOVE” 就会出现葛军⾃⼰的图⽚和提⽰消息框藏在Image2⾥,Image2属性是设置为隐藏的。
procedure TAboutForm.FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
//是否按下ALT键,只接收字符
if (shift=[ssALT]) and (key>=$41) and (key<=$5A) then
begin
keytp:=keytp+chr(key);
if keytp='HUIGEZI' then
begin
Image2.Visible:=Tr;
//Close;
end;
if keytp='LOVE' then
begin
Showmessage(EOL+'慧到永远!'+EOL+  EOL+'      葛军');
keytp:='';
Close;
end;
end;
end;
end.
-----------------------
⼩结:这个简单的 about 窗⼝隐藏的⽞机也不少哦,呵呵看了以后真的是收获不少,特别是关于隐藏版权信息的这些,可见作者的⽤⼼良苦,有些东西是很值得借鉴的

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。