|
说起迅雷广告这类的弹出窗口提示,简直让我无法忍受,广告总屏蔽不了,可恶。
不过这类的窗口有的确实做得很好,开机时间、地理信息、IP地址、本地时间,甚至是天气预报,它都可以给你显示出来,让我佩服的是即使是断网的情况下,有的也可以显示出这些信息,好比360的开机助手,本人的开机速度简直是弱爆了,所以就不上图了。
所以,今天,我就来献上我个人的窗口提示,呵呵。
程序是用delphi平台写的。
界面布局:

其中sLabel1.Caption是显示消息内容,sLabel2.Caption是显示上次时间,sLabel3.Caption是显示上次地点;Image2是显示木马的图像,Image1是显示背景;SpeedButton1是查看按钮;使用AlphaLite皮肤控件,自己做的皮肤还是有点bug的。
代码:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, sSkinManager, ExtCtrls, StdCtrls, Buttons, sBitBtn, sLabel ,inifiles,
IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient, IdHTTP, ShellApi;
type
TForm1 = class(TForm)
sSkinManager1: TsSkinManager;
Image1: TImage;
sLabel1: TsLabel;
Image2: TImage;
sLabel2: TsLabel;
IdHTTP1: TIdHTTP;
sLabel3: TsLabel;
SpeedButton1: TSpeedButton;
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure SpeedButton1Click(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
function GetWebPage(const Url:string;IsUtf8:Boolean=False):string;
public
{ Public declarations }
end;
const
str:array[0..7] of string=(
'我是木马!呵呵!',
'【雷友特权】国庆专题活动四!玩《醉西游》领取迅雷会员!',
'亲!',
'黄金周今结束 北京7大高速恐拥堵至深夜',
'河北保定居民楼爆炸案系刑事案 致1死34伤',
'7日16时播小德VS特松加争冠',
'7日19:30播阿扎决战莎娃',
'新华社三问华山游客被刺案:为何说法不一'
); //广告内容
strnum=7; //广告数目-1
var
Form1: TForm1;
SysTime:TSystemTime;
wYear: Word;
wMonth: Word;
wDay: Word;
wHour: Word;
wMinute: Word;
lastini: TIniFile;
a0,a1,a2,a3,a4: Word;
temp:string;
tip:integer;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
Randomize;
sleep(Random(10));
tip:=Random(strnum);
sLabel1.Font.Color:=rgb(34,122,203); //字体颜色
sLabel1.Caption:=str[tip]+' 查看详情>>';
GetLocalTime(SysTime); //本地时间
//GetSystemTime(SysTime); //乔治格林时间
temp:=GetWebPage('http://www.ip138.com/ips1388.asp');
Delete(temp,1,Pos(' 来自',temp)+6); //Pos()函数对汉字怎么进行使用?
temp:=Copy(temp,1,Pos('<',temp)-1);
lastini:=Tinifile.Create('.\lastrun.ini');
if lastini.readinteger('上次运行','lastrun',0)=0 then
begin
sLabel2.Caption:=IntToStr(SysTime.wYear)+'-'+IntToStr(SysTime.wMonth)+'-'+IntToStr(SysTime.wDay)+' '+IntToStr(SysTime.wHour)+':'+IntToStr(SysTime.wMinute);
sLabel3.Caption:=temp;
end
else
begin
a0:=lastini.readinteger('年','year',1); //读取ini文件
a1:=lastini.readinteger('月','month',1);
a2:=lastini.readinteger('日','day',1);
a3:=lastini.readinteger('时','hour',1);
a4:=lastini.readinteger('分','minute',1);
sLabel2.Caption:=IntToStr(a0)+'-'+IntToStr(a1)+'-'+IntToStr(a2)+' '+IntToStr(a3)+':'+IntToStr(a4);
sLabel3.Caption:=lastini.readstring('地点','locale',''); //显示上次信息
end;
end;
procedure TForm1.FormDestroy(Sender: TObject); //信息写入ini文件
var
lastini: Tinifile;
begin
lastini:=Tinifile.Create('.\lastrun.ini');
if sLabel2.Caption='' then lastini.writeinteger('上次运行','lastrun',0)
else
begin
lastini.writeinteger('上次运行','lastrun',1);
lastini.writeinteger('年','year',SysTime.wYear);
lastini.writeinteger('月','month',SysTime.wMonth);
lastini.writeinteger('日','day',SysTime.wDay);
lastini.writeinteger('时','hour',SysTime.wHour);
lastini.writeinteger('分','minute',SysTime.wMinute);
lastini.writestring('地点','locale',temp);
end;
end;
function TForm1.GetWebPage(const Url: string; IsUtf8: Boolean): string; //通过外网获取ip,地理信息,Ps:这段子程序来自网友的。
var
idp:TidHTTP;
begin
Result:='';
idp:=TIdHTTP.Create(Application);
try
idp.HandleRedirects:=True;
idp.Request.UserAgent:='Mozilla/5.0';
Result:=idp.Get(Url);
if IsUtf8 then
Result:=Utf8ToAnsi(Result);
finally
FreeAndNil(idp);
end;
end;
procedure TForm1.SpeedButton1Click(Sender: TObject); //查看按钮事件
begin
ShellExecute(handle,nil,pchar('http://www.baidu.com/s?wd='+str[tip]+'&rsv_bp=0&rsv_spt=3&rsv_sug3=3&rsv_sug1=3&rsv_sug4=203&inputT=1021'),nil,nil,sw_shownormal);
//打开搜索内容
Form1.Close;
end;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
ANimateWindow(handle,400,aw_slide+aw_ver_positive+aw_hide); //窗口关闭效果:自顶向下,400us
end;
end.
显示效果:

图片我也想设计成随机变换的,可惜,我不会。我只能说,点击查看的效果还不错,也就只能这样了。(∩_∩)
由于时间、地理信息是保存在ini文件里的,所以可以像爆破XX软件一样,修改内容,达到一定的效果,比如:

|
|