一起解剖灰鸽子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('http://www.baidu.com'), 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 窗口隐藏的玄机也不少哦,呵呵 看了以后 真的是收获不少,特别是关于隐藏版权信息的这些,可见作者的用心良苦,有些东西是很值得借鉴的

 

posted @ 2012-03-22 20:53  欢喜王子  阅读(609)  评论(0编辑  收藏  举报