一起解剖灰鴿子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 窗口隱藏的玄機也不少哦,呵呵 看了以后 真的是收獲不少,特別是關於隱藏版權信息的這些,可見作者的用心良苦,有些東西是很值得借鑒的

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM