卖掉<桌面开屏>软件客户端源码(200分)

  • 主题发起人 主题发起人 linuxping
  • 开始时间 开始时间
L

linuxping

Unregistered / Unconfirmed
GUEST, unregistred user!
低价出售<br><br>参见网址 www.duping.net.cn<br><br>其实更多的功能被屏蔽掉了.<br>比如:<br>  支持Socks代理,http代理,ftp代理.<br>  可以在桌面上随便写留言条.<br>  支持多个服务器的负荷均衡<br>  支持服务器向客户端定点发送信息等.
 
?<br>郁闷。。。。。。。。。
 
不知道是什么好东西?帮您顶
 
只见过孔雀开屏,还真没见过桌面开屏
 
这个不是和“开屏桌面画报”一样吗<br>我用它几个月了,无聊时可以看看那些精美图片,看一些时尚信息,我用着挺好用的,<br>但值多少钱我就不敢说了,因为我对这个不敢贸然揣测,至少值几万元吧
 
个人觉得要发展这个软件要在开出来的图片里加入广告,靠广告收入
 
to 幸福人生1:<br> 确实就是 开屏桌面画报<br><br>to 迷 路 人:<br>&nbsp; 你的观点我很同意.<br> 但我是个人,靠广告收入,很难推广.<br> 另外,可以和电信,水厂什么的绑定,用来查询话费,水费等.<br> 当然还有其他用途,仁者见仁了.  
 
新鲜玩意?
 
弹出窗口?
 
多谢 无欲则刚 kinneng 2位关心 &nbsp; &nbsp; &nbsp; &nbsp;<br>&nbsp;<br>&nbsp;<br>不是什么 新鲜玩意 也没有 弹出窗口。
 
很漂亮,做得相当不错哈。<br>不过我的卡巴斯基主动防御有这个警告:<br>【进程试图更改 删除 这个在注册表中属于组 Kaspersky Settings.<br>键值: HKEY_LOCAL_MACHINE/SOFTWARE/CLASSES/CLSID/{51D33728-411D-423D-B1C3-92717AB6970A}/Control】<br><br>源码目前对我来说还是没用,先帮你顶一下。
 
多谢xifengge<br><br>我会注意你出现的问题。
 
什么都是钱。
 
为了生活
 
写软件不是为赚钱就是为了出名,难道为了自娱自乐,写软件也要投入,也要成本的,<br>而且好软件的成本也相应巨大,别又天真又傻了。
 
就说www.duping.net.cn吧<br><br><br>不给俺钱,俺的东西还挂着~ &nbsp;我靠~~
 
发点源代码:<br>{*******************************************************}<br>{ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br>{ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;解析XML文件单元 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br>{ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br>{*******************************************************}<br><br><br>unit XMLReader;<br><br>interface<br><br>uses SysUtils, Variants, Classes, Dialogs, Forms,xmldom, XMLIntf, msxmldom, XMLDoc,Types,Graphics,SyncObjs;<br><br>const DefBkColor=clyellow;<br>&nbsp; &nbsp; &nbsp; DefFontColor=ClRed;<br>&nbsp; &nbsp; &nbsp; DefFontSize=8;<br><br>type<br>&nbsp; TUrlCollection=class;<br>&nbsp; TUrlItem=class;<br><br>&nbsp; IUpdateFileXmlReader=Interface<br>&nbsp; &nbsp; procedure ChannelFiles(PlayType,Channel:string;var List,ListTime,ListURL:TStrings;IsLocal:Boolean=True);<br>&nbsp; &nbsp; procedure ChannelUpdateFiles(PlayType,Channel:string;var List,ListTime,ListURL:TStrings);<br>&nbsp; &nbsp; procedure AddFile(PlayType,Channel:string;FileName:string;URLFileName:string;LastModifyTime:string);<br>&nbsp; &nbsp; procedure FileUrls(PlayType,Channel,FileName:string;var URLs:TUrlCollection);<br>&nbsp; end;<br><br>&nbsp; ITopicFileXmlReader=Interface<br>&nbsp; &nbsp; &nbsp;procedure AllPlayTypes(List:TStrings);<br>&nbsp; &nbsp; &nbsp;procedure ChannelsOfPlayType(PlayTypeName:String;List:TStrings);<br>&nbsp; end;<br><br>&nbsp; TBaseXmlReader=class(TInterfacedObject)<br>&nbsp; &nbsp; private<br>&nbsp; &nbsp; &nbsp; FXmlDoc:TXMLDocument;<br>&nbsp; &nbsp; &nbsp; FPath:string;<br>&nbsp; &nbsp; &nbsp; procedure SetDocText(Text:string);<br>&nbsp; &nbsp; &nbsp; function GetDocText:string;<br>&nbsp; &nbsp; public<br>&nbsp; &nbsp; &nbsp; procedure SaveToFile;overload;<br>&nbsp; &nbsp; &nbsp; procedure EnumChildNodes(Node:IXMLNode;var Lst:TStrings); //枚举一个节点下的所有子节点。<br>&nbsp; &nbsp; &nbsp; procedure EnumChildNodesAttr(Node:IXMLNode;AttrName:string;var Lst:TStrings);//枚举一个节点下的所有子节点的某一属性的值<br><br>&nbsp; &nbsp; &nbsp; function FindNode(ParentNode:IXMLNode;tagName:string):IXMLNode;overload; //查找一个节点下的所有子节点中<br>&nbsp; &nbsp; &nbsp; function FindNode(ParentNode:IXMLNode;tagName:string;AttributeName,AttributeValue:WideString):IXMLNode;overload;<br>&nbsp; &nbsp; &nbsp; function FindNode(ParentNode:IXMLNode;tagName:string;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; AttributeName1,AttributeValue1:WideString;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; AttributeName2,AttributeValue2:WideString):IXMLNode;overload;<br>&nbsp; &nbsp; &nbsp; function FindNodeNext(Sibling:IXMLNode;tagName:string):IXMLNode;overload;<br>&nbsp; &nbsp; &nbsp; function FindNodeNext(Sibling:IXMLNode;tagName:string;AttributeName,AttributeValue:WideString):IXMLNode;overload;<br>&nbsp; &nbsp; &nbsp; function FindNodeNext(Sibling:IXMLNode;tagName:string;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; AttributeName1,AttributeValue1:WideString;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; AttributeName2,AttributeValue2:WideString):IXMLNode;overload;<br>&nbsp; &nbsp; public<br>&nbsp; &nbsp; &nbsp; constructor Create(APath:string);overload;<br>&nbsp; &nbsp; &nbsp; constructor Create;overload;<br>&nbsp; &nbsp; &nbsp; destructor Destroy;override;<br><br>&nbsp; &nbsp; &nbsp; procedure WriteToXML(APath:string; AStr:String); //将字符串写入到xml文件。原文件将被覆盖。<br><br>&nbsp; &nbsp; &nbsp; function FirstNode:IXMLNode;<br>&nbsp; &nbsp; &nbsp; function Root:IXMLNode;<br><br>&nbsp; &nbsp; &nbsp; function &nbsp;AddChild(Node:IXMLNode;ChildNodeName:WideString):IXMLNode; // 添加一个子节点<br>&nbsp; &nbsp; &nbsp; procedure AddAttribute(Node:IXMLNode;AttributeName,AttributeValue:WideString); // 给节点添加一个属性<br>&nbsp; &nbsp; &nbsp; procedure SetText(Node:IXMLNode;AText:WideString); &nbsp;//给节点设置一个文本值。<br><br>&nbsp; &nbsp; &nbsp; function GetNodeAttributeValue(Node:IXMLNode;AttributeName:WideString):WideString;<br>&nbsp; &nbsp; &nbsp; function GetNodeText(Node:IXMLNode):WideString;<br><br>&nbsp; &nbsp; &nbsp; procedure SaveToFile(APath:string);overload; &nbsp;//XmlDoc的内容保存到文件<br><br>&nbsp; &nbsp; &nbsp; property &nbsp;DocText:string &nbsp;read GetDocText write SetDocText;<br>&nbsp; end;<br><br>&nbsp; TUpdateFileXmlReader=class(TInterfacedObject,IUpdateFileXmlReader)<br>&nbsp; private<br>&nbsp; &nbsp; FUpdateFile,FLocalFile:TBaseXmlReader;<br>&nbsp; &nbsp; FUpdateFilePath,FLocalFilePath:string;<br>&nbsp; public<br>&nbsp; &nbsp; constructor Create(AUpdateFilePath,ALocalFilePath:String);<br>&nbsp; &nbsp; destructor Destroy;override;<br><br>&nbsp; &nbsp; procedure ChannelFiles(PlayType,Channel:string;var List,ListTime,ListURL:TStrings;IsLocal:Boolean=True);<br>&nbsp; &nbsp; procedure ChannelUpdateFiles(PlayType,Channel:string;var List,ListTime,ListURL:TStrings);<br>&nbsp; &nbsp; procedure AddFile(PlayType,Channel:string;FileName:string;URLFileName:string;LastModifyTime:string);<br>&nbsp; &nbsp; procedure FileUrls(PlayType,Channel,FileName:string;var URLs:TUrlCollection);<br>&nbsp; &nbsp; //procedure Reload;<br>&nbsp; end;<br><br>&nbsp; TTopicFileXmlReader=class(TBaseXmlReader,ITopicFileXmlReader)<br>&nbsp; public <br>&nbsp; &nbsp; &nbsp;procedure AllPlayTypes(List:TStrings);<br>&nbsp; &nbsp; &nbsp;procedure ChannelsOfPlayType(PlayTypeName:String;List:TStrings);<br>&nbsp; end;<br><br>//-------------------------------------------------------------<br>&nbsp; TUrlItem=class(TCollectionItem)<br>&nbsp; protected<br>&nbsp; &nbsp; procedure AssignTo(Dest: TPersistent);override;<br>&nbsp; public<br>&nbsp; &nbsp; Text,Src:String;<br>&nbsp; &nbsp; Position:TRect;<br>&nbsp; &nbsp; Font:TFont;<br>&nbsp; &nbsp; BkColor:TColor;<br>&nbsp; &nbsp; constructor Create(Collection: TCollection);override;<br>&nbsp; &nbsp; destructor Destroy;override;<br>&nbsp; end;<br>&nbsp; TUrlItemClass=class of TUrlItem;<br><br>&nbsp; TUrlCollection=class(TCollection)<br>&nbsp; &nbsp; protected<br>&nbsp; &nbsp; &nbsp; procedure ParseUrl(APath:string);virtual;<br>&nbsp; &nbsp; public<br>&nbsp; &nbsp; &nbsp; constructor Create(APath:string);reintroduce;<br>&nbsp; end;<br><br>&nbsp; //---------------------------------------------<br>&nbsp; function ParserColor(C:String):TColor;<br>&nbsp; function PaserToHtml(AText:String):string; //替换掉一些字符,使之成为html格式。<br><br>implementation<br><br>uses StrUtils;<br><br>var<br>&nbsp; &nbsp; &nbsp;FCS:TCriticalSection;<br><br>&nbsp; function PaserToHtml(AText:String):string; //替换掉一些字符,使之成为html格式。<br>&nbsp; begin<br>&nbsp; &nbsp; AText:= StringReplace(AText,'(','&lt;',[rfReplaceAll , rfIgnoreCase]);<br>&nbsp; &nbsp; Result:= StringReplace(AText,')','&gt;',[rfReplaceAll , rfIgnoreCase]);<br>&nbsp; end;<br>&nbsp; // &nbsp;#AAFFCC----&gt;$AAFFCC<br>&nbsp; function ParserColor(C:String):TColor;<br>&nbsp; begin<br>&nbsp; &nbsp; if LeftStr(C,1)='#' then<br>&nbsp; &nbsp; &nbsp; AnsiReplaceStr(C,'#','$');<br>&nbsp; &nbsp; Result:=StrToIntDef(C,clWhite);<br>&nbsp; end;<br><br>{ TBaseXmlReader }<br><br>procedure TBaseXmlReader.AddAttribute(Node: IXMLNode; AttributeName,<br>&nbsp; AttributeValue: WideString);<br>begin<br>&nbsp; FXMLDoc.Active:=True;<br>&nbsp; Node.Attributes[AttributeName]:=AttributeValue;<br>end;<br><br>function TBaseXmlReader.AddChild(Node: IXMLNode;<br>&nbsp; ChildNodeName: WideString): IXMLNode;<br>begin<br>&nbsp; FXMLDoc.Active:=True;<br>&nbsp; Result:=Node.AddChild(ChildNodeName);<br>end;<br><br>procedure TBaseXmlReader.SetText(Node: IXMLNode; AText: WideString);<br>begin<br>&nbsp; FXMLDoc.Active:=True;<br>&nbsp; Node.Text:=AText;<br>end;<br><br>constructor TBaseXmlReader.Create(APath:string);<br>begin<br>&nbsp; FXMLDoc:=TXMLDocument.Create(Application);<br>&nbsp; FPath:=APath;<br>&nbsp; FXmlDoc.LoadFromFile(APath);<br>&nbsp; try<br>&nbsp; &nbsp; FXMLDoc.Active:=True;<br>&nbsp; except<br>&nbsp; &nbsp;//;<br>&nbsp; end;<br>&nbsp; FXMLDoc.Encoding:='GB2312';<br>&nbsp; FXMLDoc.Options:=[doNodeAutoCreate,doNodeAutoIndent ,doAutoSave,doAttrNull];<br>&nbsp; FXmlDoc.ParseOptions:=FXmlDoc.ParseOptions+[poAsyncLoad];<br>&nbsp; if FXMLDoc.IsEmptyDoc then<br>&nbsp; begin<br>&nbsp; &nbsp; FXMLDoc.Active:=False;<br>&nbsp; &nbsp; FXMLDoc.XML.Text:='&lt;?xml version="1.0" encoding="GB2312"?&gt; &lt;Root&gt;&lt;/Root&gt; &nbsp;';<br>&nbsp; &nbsp; FXMLDoc.Active:=True;<br>&nbsp; end;<br>end;<br><br>constructor TBaseXmlReader.Create;<br>begin<br>&nbsp; FXMLDoc:=TXMLDocument.Create(Application);<br><br>&nbsp; if FXMLDoc.IsEmptyDoc then<br>&nbsp; begin<br>&nbsp; &nbsp; FXMLDoc.Active:=False;<br>&nbsp; &nbsp; FXMLDoc.XML.Text:='&lt;?xml version="1.0" encoding="GB2312"?&gt;&lt;Root&gt;&lt;/Root&gt; &nbsp;';<br>&nbsp; &nbsp; FXMLDoc.Active:=True;<br>&nbsp; end;<br>&nbsp; FXMLDoc.Encoding:='GB2312';<br>&nbsp; FXMLDoc.Options:=[doNodeAutoCreate,doNodeAutoIndent ,doAutoSave];<br>end;<br><br>destructor TBaseXmlReader.Destroy;<br>begin<br>&nbsp; FXMLDoc.Active:=False;<br>&nbsp; FXMLDoc:=nil;<br>&nbsp; inherited;<br>end;<br><br>procedure TBaseXmlReader.WriteToXML(APath, AStr: String);<br>begin<br>&nbsp; SetDocText(AStr);<br>&nbsp; SaveToFile(APath);<br>&nbsp; FXmlDoc.LoadFromFile(APath);<br>end;<br><br>procedure TBaseXmlReader.SetDocText(Text: string);<br>begin<br>&nbsp; try<br>&nbsp; &nbsp; FXMLDoc.Active:=False;<br>&nbsp; &nbsp; FXMLDoc.XML.Text:=Text;<br>&nbsp; &nbsp; FXMLDoc.Active:=True;<br>&nbsp; Except<br>&nbsp; &nbsp; MessageDlg('错误的XML文件格式!', mtError,[mbYes],0);<br>&nbsp; &nbsp; Abort;<br>&nbsp; end;<br>end;<br><br>procedure TBaseXmlReader.SaveToFile(APath: string);<br>begin &nbsp; &nbsp; &nbsp;//Encoding NOT Write!!!<br>&nbsp; FXMLDoc.NodeIndentStr:=#32#32;<br>&nbsp; FXMLDoc.Active:=True;<br>&nbsp; FXmlDoc.SaveToFile(APath);<br>end;<br><br>function TBaseXmlReader.GetNodeAttributeValue(Node: IXMLNode;<br>&nbsp; AttributeName:WideString): WideString;<br>begin<br>&nbsp; Result:=Node.Attributes[AttributeName]; &nbsp; //if AttributeName NOT Exist, Return Empty str .<br>end;<br><br>function TBaseXmlReader.GetNodeText(Node: IXMLNode): WideString;<br>begin &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//if TextNodes NOT Found, Error Occur .<br>&nbsp; Result:=Node.Text;<br>end;<br><br>function TBaseXmlReader.GetDocText: string;<br>begin<br>&nbsp; FXMLDoc.Active:=True;<br>&nbsp; Result:=FXMLDoc.XML.Text;<br>end;<br><br>function TBaseXmlReader.FirstNode: IXMLNode;<br>begin<br>&nbsp; &nbsp;Result:=nil;<br>&nbsp; &nbsp;if root.HasChildNodes then<br>&nbsp; &nbsp; &nbsp; &nbsp;Result:=root.ChildNodes[0];<br>end;<br><br>function TBaseXmlReader.Root: IXMLNode;<br>begin<br>&nbsp; try<br>&nbsp; &nbsp; Result :=FXMLDoc.ChildNodes.Get(1);<br>&nbsp; except<br>&nbsp; &nbsp; Result:=nil;<br>&nbsp; end; &nbsp;//if FirstNode Not Exsit , An Error occur.<br>end;<br><br>procedure TBaseXmlReader.EnumChildNodes(Node: IXMLNode; var Lst: TStrings);<br>var<br>&nbsp; I:Integer;<br>begin<br>&nbsp; for I:=0 to Node.ChildNodes.Count-1 do<br>&nbsp; &nbsp; Lst.Add(Node.ChildNodes.NodeName)<br>end;<br><br>function TBaseXmlReader.FindNode(ParentNode: IXMLNode;<br>&nbsp;tagName: string): IXMLNode;<br>begin<br>&nbsp; if ParentNode=nil then Exit;<br>&nbsp; Result:=ParentNode.ChildNodes.FindNode(tagName);<br>end;<br><br>function TBaseXmlReader.FindNode(ParentNode: IXMLNode; tagName: string;<br>&nbsp; AttributeName1, AttributeValue1, AttributeName2,<br>&nbsp; AttributeValue2: WideString): IXMLNode;<br>var<br>&nbsp;N:IXMLNode;<br>begin<br>&nbsp; Result:=Nil;<br>&nbsp; N:=FindNode(ParentNode,tagName);<br>&nbsp; if N=nil then Exit;<br><br>&nbsp; while N&lt;&gt;nil do<br>&nbsp; begin<br>&nbsp; &nbsp; if (N.NodeName=tagName) AND(N.Attributes[AttributeName1]=AttributeValue1) and (N.Attributes[AttributeName2]=AttributeValue2) then<br>&nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; Result:=N;<br>&nbsp; &nbsp; &nbsp; Exit;;<br>&nbsp; &nbsp; end;<br><br>&nbsp; &nbsp; N:=N.NextSibling;<br>&nbsp; end;<br>end;<br><br>function TBaseXmlReader.FindNode(ParentNode: IXMLNode; tagName: string;<br>&nbsp; AttributeName, AttributeValue: WideString): IXMLNode;<br>var<br>&nbsp;N:IXMLNode;<br>begin<br>&nbsp; Result:=Nil;<br>&nbsp; N:=FindNode(ParentNode,tagName);<br>&nbsp; if N=nil then Exit;<br><br>&nbsp; while N&lt;&gt;nil do<br>&nbsp; begin<br>&nbsp; &nbsp; //ShowMessage((WideCharToString(PWideChar(WideUpperCase(N.NodeName)))));<br>&nbsp; &nbsp; //ShowMessage(WideUpperCase(N.Attributes[AttributeName]));<br>&nbsp; &nbsp; if ((WideCharToString(PWideChar(WideUpperCase(N.NodeName))))=UpperCase(tagName)) AND (WideUpperCase(N.Attributes[AttributeName])=WideUpperCase(AttributeValue)) then<br>&nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; Result:=N;<br>&nbsp; &nbsp; &nbsp; Exit;;<br>&nbsp; &nbsp; end;<br><br>&nbsp; &nbsp; //while (N&lt;&gt;nil) and (N.NodeName&lt;&gt;tagName)do<br>&nbsp; &nbsp; N:=N.NextSibling;<br>&nbsp; end;<br>end;<br><br>function TBaseXmlReader.FindNodeNext(Sibling: IXMLNode;<br>&nbsp; tagName: string): IXMLNode;<br>var<br>&nbsp;N:IXMLNode;<br>begin<br>&nbsp; Result:=Nil;<br>&nbsp; N:=Sibling.NextSibling;<br>&nbsp; if N=nil then Exit;<br><br>&nbsp; while N&lt;&gt;nil do<br>&nbsp; begin<br>&nbsp; &nbsp; if UpperCase(N.NodeName)=UpperCase(tagName) then<br>&nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; Result:=N;<br>&nbsp; &nbsp; &nbsp; Exit;;<br>&nbsp; &nbsp; end;<br>&nbsp; &nbsp; N:=N.NextSibling;<br>&nbsp; end;<br>end;<br><br>function TBaseXmlReader.FindNodeNext(Sibling: IXMLNode; tagName: string;<br>&nbsp; AttributeName1, AttributeValue1, AttributeName2,<br>&nbsp; AttributeValue2: WideString): IXMLNode;<br>var<br>&nbsp;N:IXMLNode;<br>begin<br>&nbsp; Result:=Nil;<br>&nbsp; N:=FindNode(Sibling.ParentNode,tagName);<br>&nbsp; if N=nil then Exit;<br><br>&nbsp; N:=N.NextSibling;<br>&nbsp; while (N&lt;&gt;nil) or (N.NodeName&lt;&gt;tagName) or (N.Attributes[AttributeName1]&lt;&gt;AttributeValue1) or (N.Attributes[AttributeName2]&lt;&gt;AttributeValue2) do<br>&nbsp; &nbsp; N:=N.NextSibling;<br>&nbsp; Result:=N;<br>end;<br><br>function TBaseXmlReader.FindNodeNext(Sibling: IXMLNode; tagName: string;<br>&nbsp; AttributeName, AttributeValue: WideString): IXMLNode;<br>var<br>&nbsp;N:IXMLNode;<br>begin<br>&nbsp; Result:=Nil;<br>&nbsp; N:=FindNode(Sibling.ParentNode,tagName);<br>&nbsp; if N=nil then Exit;<br><br>&nbsp; N:=N.NextSibling;<br>&nbsp; while (N&lt;&gt;nil) or (N.NodeName&lt;&gt;tagName) or (N.Attributes[AttributeName]&lt;&gt;AttributeValue) do<br>&nbsp; &nbsp; N:=N.NextSibling;<br>&nbsp; Result:=N;<br>end;<br><br><br>procedure TBaseXmlReader.EnumChildNodesAttr(Node: IXMLNode;AttrName:string;<br>&nbsp; var Lst: TStrings);<br>var<br>&nbsp; I:Integer;<br>begin<br>&nbsp; for I:=0 to Node.ChildNodes.Count-1 do<br>&nbsp; &nbsp; Lst.Add(WideCharToString(PWideChar(VarToWideStr(Node.ChildNodes.Attributes[AttrName]))));<br>end;<br><br><br>procedure TBaseXmlReader.SaveToFile;<br>begin<br>&nbsp; FXmlDoc.SaveToFile(Self.FPath);<br>end;<br><br><br>{ TTopicFileXmlReader }<br><br>procedure TTopicFileXmlReader.AllPlayTypes(List: TStrings);<br>var<br>&nbsp; N:IXMLNode;<br>begin<br>&nbsp; Assert(Assigned(List),Format('类%S的方法%S的参数%S未赋值。',[Self.ClassName,'AllPlayTypes','List']));<br>&nbsp; List.Clear;<br>&nbsp; N:=Self.FirstNode;<br>&nbsp; if N=nil then &nbsp;Exit;<br>&nbsp; while N&lt;&gt;nil do<br>&nbsp; begin<br>&nbsp; &nbsp; if N.HasAttribute('TypeName') then<br>&nbsp; &nbsp; &nbsp; List.Add(N.Attributes['TypeName']);<br>&nbsp; &nbsp; N:=Self.FindNodeNext(N,'PlayType');<br>&nbsp; end;<br>end;<br><br>procedure TTopicFileXmlReader.ChannelsOfPlayType(PlayTypeName: String;<br>&nbsp; List: TStrings);<br>var<br>&nbsp; N,C:IXMLNode;<br>begin<br>&nbsp; Assert(Assigned(List),Format('类%S的方法%S的参数%S未赋值。',[Self.ClassName,'ChannelsOfPlayType','List']));<br>&nbsp; List.Clear;<br>&nbsp; N:=Self.FirstNode;<br>&nbsp; if N=nil then &nbsp;Exit;<br><br>&nbsp; while N&lt;&gt;nil do<br>&nbsp; begin<br>&nbsp; &nbsp; if N.HasAttribute('TypeName') and (UpperCase(N.Attributes['TypeName'])=UpperCase(PlayTypeName)) then<br>&nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; C:=nil;<br>&nbsp; &nbsp; &nbsp; if N.HasChildNodes then<br>&nbsp; &nbsp; &nbsp; &nbsp; C:=N.ChildNodes[0];<br><br>&nbsp; &nbsp; &nbsp; while C&lt;&gt;nil do<br>&nbsp; &nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; &nbsp; if C.HasAttribute('id') then<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; List.Add(C.Attributes['id']);<br>&nbsp; &nbsp; &nbsp; &nbsp; C:=Self.FindNodeNext(C,'txt');<br>&nbsp; &nbsp; &nbsp; end;<br>&nbsp; &nbsp; end;<br><br>&nbsp; &nbsp; N:=Self.FindNodeNext(N,'PlayType');<br>&nbsp; end;<br>end;<br><br>{ TUrlItem }<br><br>procedure TUrlItem.AssignTo(Dest: TPersistent);<br>begin<br>&nbsp; if &nbsp;Dest is TUrlItem then<br>&nbsp; begin<br>&nbsp; &nbsp; TUrlItem(Dest).Text:=Self.Text;<br>&nbsp; &nbsp; TUrlItem(Dest).Src:=Self.Src;<br>&nbsp; &nbsp; TUrlItem(Dest).Position:=Self.Position;<br>&nbsp; &nbsp; TUrlItem(Dest).Font.Assign(Self.Font);<br>&nbsp; end<br>&nbsp; else<br>&nbsp; &nbsp; inherited;<br>end;<br><br>constructor TUrlItem.Create(Collection: TCollection);<br>begin<br>&nbsp; inherited;<br>&nbsp; Font:=TFont.Create;<br>&nbsp; Font.Color:=clRed;<br><br>&nbsp; BkColor:=clWhite;<br><br>&nbsp; Text:='';<br>&nbsp; Position.Left:=0;<br>&nbsp; Position.Top:=0;<br>&nbsp; Position.Right:=0;<br>&nbsp; Position.Bottom:=0;<br><br>&nbsp; Src:='';<br>end;<br><br>destructor TUrlItem.Destroy;<br>begin<br>&nbsp; if Font&lt;&gt;nil then Font.Free;<br>&nbsp; inherited;<br>end;<br><br>{ TUrlCollection }<br><br>constructor TUrlCollection.Create(APath:string);<br>begin<br>&nbsp; inherited Create(TUrlItem);<br>&nbsp; //解析url<br>&nbsp; try<br>&nbsp; &nbsp; ParseUrl(APath);<br>&nbsp; except<br>&nbsp; end; &nbsp;<br>end;<br><br>procedure TUrlCollection.ParseUrl(APath:string);<br>var<br>&nbsp; FXmlReader:TBaseXmlReader;<br>&nbsp; First,Sec:IXMLNode;<br>&nbsp; Item:TUrlItem;<br>&nbsp; //Font:TFont;<br>begin<br>&nbsp; FXmlReader:=TBaseXmlReader.Create(APath);<br>&nbsp; try<br>&nbsp; &nbsp; First:=FXmlReader.FirstNode; //urlinfo Node<br>&nbsp; &nbsp; if First=nil then Exit;<br><br>&nbsp; &nbsp; while First&lt;&gt;nil do<br>&nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; Item:=TUrlItem(Self.Add);<br>&nbsp; &nbsp; &nbsp; Sec:=FXmlReader.FindNode(First,'Position');<br>&nbsp; &nbsp; &nbsp; if Sec&lt;&gt;nil then<br>&nbsp; &nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; &nbsp; if Sec.HasAttribute('Left') then<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Item.Position.Left:=Sec.Attributes['Left'];<br>&nbsp; &nbsp; &nbsp; &nbsp; if Sec.HasAttribute('Top') then<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Item.Position.Top:=Sec.Attributes['Top'];<br>&nbsp; &nbsp; &nbsp; &nbsp; if Sec.HasAttribute('Width') then<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Item.Position.Right:=Sec.Attributes['Width'];<br>&nbsp; &nbsp; &nbsp; &nbsp; if Sec.HasAttribute('Height') then<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Item.Position.Bottom:=Sec.Attributes['Height'];<br>&nbsp; &nbsp; &nbsp; end;<br><br>&nbsp; &nbsp; &nbsp; Sec:=FXmlReader.FindNode(First,'font');<br>&nbsp; &nbsp; &nbsp; if Sec&lt;&gt;nil then<br>&nbsp; &nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; &nbsp; Item.Font.Size:=DefFontSize;<br>&nbsp; &nbsp; &nbsp; &nbsp; if Sec.HasAttribute('bkcolor') then<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if ParserColor(Sec.Attributes['bkcolor'])=clwhite then<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Item.BkColor:=DefBkColor<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Item.BkColor:=ParserColor(Sec.Attributes['bkcolor']);<br>&nbsp; &nbsp; &nbsp; &nbsp; if Sec.HasAttribute('Fontcolor') then<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (ParserColor(Sec.Attributes['Fontcolor'])=clwhite) or (ParserColor(Sec.Attributes['Fontcolor'])=Item.BkColor) then<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Item.Font.Color:=DefFontColor<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Item.Font.Color:=ParserColor(Sec.Attributes['Fontcolor']);<br>&nbsp; &nbsp; &nbsp; end;<br><br>&nbsp; &nbsp; &nbsp; Sec:=FXmlReader.FindNode(First,'text');<br>&nbsp; &nbsp; &nbsp; if Sec&lt;&gt;nil then<br>&nbsp; &nbsp; &nbsp; &nbsp; if Sec.HasAttribute('data') then<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Item.Text:=Sec.Attributes['data'];<br><br>&nbsp; &nbsp; &nbsp; Sec:=FXmlReader.FindNode(First,'link');<br>&nbsp; &nbsp; &nbsp; if Sec&lt;&gt;nil then<br>&nbsp; &nbsp; &nbsp; &nbsp; if Sec.HasAttribute('Src') then<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Item.Src:=Sec.Attributes['Src'];<br><br>&nbsp; &nbsp; &nbsp; First:=FXmlReader.FindNodeNext(First,'URLInfo');<br>&nbsp; &nbsp; end;<br>&nbsp; finally<br>&nbsp; &nbsp; FXmlReader.Free;<br>&nbsp; end;<br>end;<br><br>{ TUpdateFileXmlReader }<br><br>procedure TUpdateFileXmlReader.AddFile(PlayType, Channel, FileName,<br>&nbsp; URLFileName, LastModifyTime: string);<br>var<br>&nbsp; nPlayType,nChannel,nFile:IXMLNode;<br>&nbsp; //I:Integer;<br>begin<br>&nbsp; if &nbsp;Trim(PlayType)='' then Exit;<br>&nbsp; nPlayType:=FLocalFile.FindNode(FLocalFile.Root,'PlayType','TypeName',PlayType);<br>&nbsp; if nPlayType=nil then<br>&nbsp; begin<br>&nbsp; &nbsp; nPlayType:=FLocalFile.Root.AddChild('PlayType');<br>&nbsp; &nbsp; nPlayType.Attributes['TypeName']:=PlayType;<br>&nbsp; end;<br><br>&nbsp; if Trim(Channel)='' then Exit;<br>&nbsp; nChannel:=FLocalFile.FindNode(nPlayType,'Channel','ChannelName',Channel);<br>&nbsp; if nChannel=nil then<br>&nbsp; begin<br>&nbsp; &nbsp; nChannel:=nPlayType.AddChild('Channel');<br>&nbsp; &nbsp; nChannel.Attributes['ChannelName']:=Channel;<br>&nbsp; end;<br><br>&nbsp; if Trim(FileName)='' then Exit;<br>&nbsp; nFile:=FLocalFile.FindNode(nChannel,'File','FileName',FileName);<br>&nbsp; if nFile =nil then nFile:=nChannel.AddChild('File');<br><br>&nbsp; nFile.Attributes['FileName']:=FileName;<br>&nbsp; nFile.Attributes['LastModifyTime']:=LastModifyTime;<br>&nbsp; nFile.Attributes['url']:=URLFileName;<br><br>&nbsp; //FLocalFile.SaveToFile;<br>end;<br><br><br><br>procedure TUpdateFileXmlReader.ChannelFiles(PlayType, Channel: string;<br>&nbsp; var List,ListTime,ListURL: TStrings; IsLocal: Boolean);<br>var<br>&nbsp; xml:TBaseXmlReader;<br>&nbsp; nPlayType,nChannel{,nFile}:IXMLNode;<br>&nbsp; I:Integer;<br>begin<br>&nbsp; if IsLocal then<br>&nbsp; &nbsp; xml:=FLocalFile<br>&nbsp; else<br>&nbsp; &nbsp; Xml:=FUpdateFile;<br><br>&nbsp; List.Clear; ListTime.Clear;ListURL.Clear;<br><br>&nbsp; nPlayType:=xml.FindNode(xml.Root,'PlayType','TypeName',PlayType);<br>&nbsp; if nPlayType=nil then Exit;<br><br>&nbsp; nChannel:=xml.FindNode(nPlayType,'Channel','ChannelName',Channel);<br>&nbsp; if nChannel=nil then Exit;<br><br>&nbsp; for I:=0 to nChannel.ChildNodes.Count-1 do<br>&nbsp; begin<br>&nbsp; &nbsp; if &nbsp;nChannel.ChildNodes.HasAttribute('FileName') then<br>&nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; List.Add(UpperCase(nChannel.ChildNodes.Attributes['FileName']));<br><br>&nbsp; &nbsp; &nbsp; if &nbsp;nChannel.ChildNodes.HasAttribute('LastModifyTime') then<br>&nbsp; &nbsp; &nbsp; &nbsp; ListTime.Add(UpperCase(nChannel.ChildNodes.Attributes['LastModifyTime']))<br>&nbsp; &nbsp; &nbsp; else<br>&nbsp; &nbsp; &nbsp; &nbsp; ListTime.Add('');<br><br>&nbsp; &nbsp; &nbsp; if &nbsp;nChannel.ChildNodes.HasAttribute('url') then<br>&nbsp; &nbsp; &nbsp; &nbsp; ListURL.Add(UpperCase(nChannel.ChildNodes.Attributes['url']))<br>&nbsp; &nbsp; &nbsp; else<br>&nbsp; &nbsp; &nbsp; &nbsp; ListURL.Add('');<br>&nbsp; &nbsp; end;<br>&nbsp; end;<br>end;<br><br>procedure TUpdateFileXmlReader.ChannelUpdateFiles(PlayType,<br>&nbsp; Channel: string; var List,ListTime,ListURL: TStrings);<br>var<br>&nbsp; oList,oListTime,oListURL,nList,nListTime,nListURL:TStrings;<br>&nbsp; I,index:Integer;<br>&nbsp; oTime,nTime:TDateTime;<br><br>&nbsp; procedure FreeLists;<br>&nbsp; begin<br>&nbsp; &nbsp; FreeAndNil(nListURL);<br>&nbsp; &nbsp; FreeAndNil(nListTime);<br>&nbsp; &nbsp; FreeAndNil(nList);<br>&nbsp; &nbsp; FreeAndNil(oListURL);<br>&nbsp; &nbsp; FreeAndNil(oListTime);<br>&nbsp; &nbsp; FreeAndNil(oList);<br>&nbsp; end;<br>begin<br>&nbsp; oList:=TStringList.Create;<br>&nbsp; oListTime:=TStringList.Create;<br>&nbsp; oListURL:=TStringList.Create;<br>&nbsp; nList:=TStringList.Create;<br>&nbsp; nListTime:=TStringList.Create;<br>&nbsp; nListURL:=TStringList.Create;<br><br>&nbsp; List.Clear;ListTime.Clear;ListURL.Clear;<br>&nbsp; try<br>&nbsp; &nbsp; Self.ChannelFiles(PlayType,Channel,oList,oListTime,oListURL,True);<br>&nbsp; &nbsp; //ShowMessage(oList.Text);<br>&nbsp; &nbsp; Self.ChannelFiles(PlayType,Channel,nList,nListTime,nListURL,False);<br>&nbsp; &nbsp; //ShowMessage(nList.Text);<br>&nbsp; &nbsp; if oList.Count=0 then &nbsp;//not such PlayType OR not such Channel.<br>&nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; List.Assign(nList);<br>&nbsp; &nbsp; &nbsp; ListTime.Assign(nListTime);<br>&nbsp; &nbsp; &nbsp; ListURL.Assign(nListURL);<br>&nbsp; &nbsp; &nbsp; FreeLists;<br>&nbsp; &nbsp; &nbsp; Exit;<br>&nbsp; &nbsp; end;<br><br>&nbsp; &nbsp; for I:=0 to nList.Count-1 do<br>&nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; index:=oList.IndexOf(nList.Strings);<br>&nbsp; &nbsp; &nbsp; if index=-1 then //not found.<br>&nbsp; &nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; &nbsp; List.Add(nList);<br>&nbsp; &nbsp; &nbsp; &nbsp; ListTime.Add(nListTime);<br>&nbsp; &nbsp; &nbsp; &nbsp; ListURL.Add(nListURL);<br>&nbsp; &nbsp; &nbsp; end<br>&nbsp; &nbsp; &nbsp; else &nbsp; &nbsp; //Found ,but Time is New .<br>&nbsp; &nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;oTime:=StrToDateTimeDef(oListTime.Strings[index],StrToDateTime('2008-1-1 00:00:00')) ;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;nTime:=StrToDateTimeDef(nListTime.Strings,StrToDateTime('2008-1-1 00:00:00')) ;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if oTime &lt;nTime then<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;begin<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;List.Add(nList);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ListTime.Add(nListTime);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ListURL.Add(nListURL);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;end;<br>&nbsp; &nbsp; &nbsp; end;<br>&nbsp; &nbsp; end;<br><br>&nbsp; finally<br>&nbsp; &nbsp; FreeLists;<br>&nbsp; end;<br>end;<br><br>constructor TUpdateFileXmlReader.Create(AUpdateFilePath,<br>&nbsp; ALocalFilePath: String);<br>begin<br>&nbsp; FCS.Enter;<br>&nbsp; inherited Create;<br>&nbsp; FUpdateFilePath:=AUpdateFilePath;<br>&nbsp; FLocalFilePath:=ALocalFilePath;<br>&nbsp; FUpdateFile:=TBaseXmlReader.Create(AUpdateFilePath);<br>&nbsp; FLocalFile:=TBaseXmlReader.Create(ALocalFilePath);<br>end;<br><br>destructor TUpdateFileXmlReader.Destroy;<br>begin<br>&nbsp; FreeAndNil(FLocalFile);<br>&nbsp; FreeAndNil(FUpdateFile);<br>&nbsp; FCS.Release;<br>&nbsp; inherited;<br>end;<br><br>procedure TUpdateFileXmlReader.FileUrls(PlayType, Channel,<br>&nbsp; FileName: string; var URLs: TUrlCollection);<br>begin<br><br>end;<br><br>//procedure TUpdateFileXmlReader.Reload;<br>//begin<br>// &nbsp;try<br>// &nbsp; &nbsp;FUpdateFile.FXmlDoc.LoadFromFile(FUpdateFilePath);<br>// &nbsp; &nbsp;FLocalFile.FXmlDoc.LoadFromFile(FLocalFilePath);<br>// &nbsp;except<br>// &nbsp;end;<br>//end;<br><br>initialization<br>&nbsp; FCS:=TCriticalSection.Create;<br>finalization<br>&nbsp; FCS.Free;<br><br>end.<br>&nbsp;<br><br><br>unit WallPaper;<br><br>interface<br><br>uses<br>&nbsp; Classes,Registry, WinProcs, SysUtils,CommCtrl,Graphics,Types,Forms,Dialogs,jpeg;<br><br>type<br>&nbsp; TBeforePlayFile =procedure (Sender:TObject; CurFileName:string) of object;<br>&nbsp; TAfterPlayFile &nbsp;=procedure (Sender:TObject; CurFileName:string) of object;<br><br>&nbsp; TTurnWallPaper=class(TThread)<br>&nbsp; private<br>&nbsp; &nbsp; FPicList:TStrings;<br>&nbsp; &nbsp; FCurPicIndex:Integer;<br>&nbsp; &nbsp; FIsPaused:Boolean;<br>&nbsp; &nbsp; FIsFirst,FIsLast:Boolean;<br>&nbsp; &nbsp; FNext:Boolean;<br>&nbsp; &nbsp; FDelay:Integer;<br>&nbsp; &nbsp; FPath:string;<br>&nbsp; &nbsp; FBeforePlayFile:TBeforePlayFile;<br>&nbsp; &nbsp; FAfterPlayFile:TAfterPlayFile;<br><br>&nbsp; &nbsp; procedure DoPlayPic;<br>&nbsp; &nbsp; procedure DoBeforePlayFile;<br>&nbsp; &nbsp; procedure DoAfterPlayFile;<br>&nbsp; &nbsp; function CheckIndex:Boolean;<br>&nbsp; &nbsp; procedure SetWallpaper(path:string);<br>&nbsp; &nbsp; procedure SetDelay(const Value: Integer);<br>&nbsp; public<br>&nbsp; &nbsp; constructor Create;<br>&nbsp; &nbsp; destructor Destroy;override;<br><br>&nbsp; &nbsp; procedure Play;<br>&nbsp; &nbsp; procedure Pause;<br>&nbsp; &nbsp; procedure PlayNext;<br>&nbsp; &nbsp; procedure PlayPrior;<br><br>&nbsp; &nbsp; procedure Execute;override;<br>&nbsp; &nbsp; procedure AddPic(Path:string);<br>&nbsp; &nbsp; procedure PicList(List:TStrings);<br><br>&nbsp; &nbsp; property IsFirst:Boolean &nbsp;read FIsFirst;<br>&nbsp; &nbsp; property IsLast:Boolean &nbsp;read FIsLast;<br>&nbsp; &nbsp; property IsPause:Boolean &nbsp;read FIsPaused;<br>&nbsp; &nbsp; property &nbsp;Delay:Integer &nbsp;read FDelay write SetDelay;<br><br>&nbsp; &nbsp; property BeforePlayFile:TBeforePlayFile &nbsp;read FBeforePlayFile write FBeforePlayFile;<br>&nbsp; &nbsp; property AfterPlayFile:TAfterPlayFile &nbsp;read FAfterPlayFile write FAfterPlayFile;<br>&nbsp; end;<br><br>function GetDesktopHand: THandle;<br>procedure HideDeskTopIcon;<br>procedure ShowDesktopIcon;<br>procedure &nbsp; JPEG2BMP(JPEGFileName:String);<br><br>type<br>&nbsp; TWallPaperStyle=(wpsTile = 0,wpsCenter,wpsSizeToFit ,wpsXY );<br>&nbsp; <br>procedure SetWallpaperExt(sWallpaperBMPPath : string;nStyle:TWallPaperStyle;nX, nY : integer );<br><br>implementation<br><br><br>procedure &nbsp; JPEG2BMP(JPEGFileName:String);<br>var<br>&nbsp; JpegImage1:TJpegImage;<br>&nbsp; Bit:TBitmap;<br>begin<br>&nbsp; JpegImage1 &nbsp; := &nbsp; TJpegImage.Create;<br>&nbsp; try<br>&nbsp; &nbsp; JpegImage1.LoadFromFile(JPEGFileName);<br>&nbsp; &nbsp; Bit:=TBitmap.Create;<br>&nbsp; &nbsp; try<br>&nbsp; &nbsp; &nbsp; Bit.Width &nbsp; := &nbsp; JpegImage1.Width &nbsp; ;<br>&nbsp; &nbsp; &nbsp; Bit.Height &nbsp; := &nbsp; JpegImage1.Height &nbsp; ;<br>&nbsp; &nbsp; &nbsp; Bit.Canvas.StretchDraw(Rect(0,0,Bit.Width,Bit.Height),JpegImage1);<br>&nbsp; &nbsp; &nbsp; Bit.SaveToFile(ChangeFileExt(JPEGFileName,'.BMP'));<br>&nbsp; &nbsp; &nbsp;finally<br>&nbsp; &nbsp; &nbsp; &nbsp;Bit.Free;<br>&nbsp; &nbsp; &nbsp;end;<br>&nbsp; finally<br>&nbsp; &nbsp; &nbsp;JpegImage1.Free;<br>&nbsp; end;<br>end;<br><br>procedure SetWallpaperExt(sWallpaperBMPPath : string;nStyle:TWallPaperStyle;nX, nY : integer );<br>var<br>&nbsp; reg &nbsp; &nbsp;: TRegIniFile;<br>&nbsp; s1 &nbsp; &nbsp; : string;<br>&nbsp; X, Y &nbsp; : integer;<br>begin<br>&nbsp; reg := TRegIniFile.Create('Control Panel/Desktop' );<br><br>&nbsp; with reg do<br>&nbsp; begin<br>&nbsp; &nbsp; s1 := '0';<br>&nbsp; &nbsp; X &nbsp;:= 0;<br>&nbsp; &nbsp; Y &nbsp;:= 0;<br>&nbsp; &nbsp; case nStyle of<br>&nbsp; &nbsp; &nbsp; wpsTile : s1 := '1';<br>&nbsp; &nbsp; &nbsp; wpsCenter: nStyle := wpsTile;<br>&nbsp; &nbsp; &nbsp; wpsXY &nbsp; &nbsp;:<br>&nbsp; &nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; &nbsp; nStyle := wpsTile;<br>&nbsp; &nbsp; &nbsp; &nbsp; X := nX;<br>&nbsp; &nbsp; &nbsp; &nbsp; Y := nY;<br>&nbsp; &nbsp; &nbsp; end;<br>&nbsp; &nbsp; end;<br>&nbsp; &nbsp; WriteString( '','Wallpaper',sWallpaperBMPPath );<br>&nbsp; &nbsp; WriteString( '','TileWallpaper',s1 );<br>&nbsp; &nbsp; WriteString( '','WallpaperStyle',IntToStr( Integer(nStyle) ) );<br>&nbsp; &nbsp; WriteString( '','WallpaperOriginX',IntToStr( X ) );<br>&nbsp; &nbsp; WriteString( '','WallpaperOriginY',IntToStr( Y ) );<br>&nbsp; end;<br>&nbsp; reg.Free;<br>&nbsp; SystemParametersInfo(SPI_SETDESKWALLPAPER,0,Nil,SPIF_SENDWININICHANGE );<br>end;<br><br>procedure HideDeskTopIcon;<br>var<br>&nbsp; hdesktop:thandle;<br>begin<br>&nbsp; hDesktop &nbsp; := &nbsp; FindWindow('ProgMan',nil) &nbsp; ;<br>&nbsp; showwindow(hdesktop,SW_HIDE)//显示桌面。<br>end;<br><br>procedure ShowDesktopIcon;<br>var<br>&nbsp; hdesktop:thandle;<br>begin<br>&nbsp; hDesktop &nbsp; := &nbsp; FindWindow('ProgMan',nil) &nbsp; ;<br>&nbsp; showwindow(hdesktop,SW_SHOW)//显示桌面。<br>end;<br><br>function GetDesktopHand: THandle;<br>begin<br>&nbsp; Result:=FindWindow('progman',nil);<br>&nbsp; Result:=GetWindow(Result,GW_Child);<br>&nbsp; Result:=GetWindow(Result,GW_Child);<br>end;<br><br>{ TTurnWallPaper }<br><br>procedure TTurnWallPaper.AddPic(Path:string);<br>var<br>&nbsp; temp:Boolean;<br>begin<br>&nbsp; temp:=FIsPaused;<br>&nbsp; if not FIsPaused then Pause;<br>&nbsp; FPicList.Add(Path);<br>&nbsp; FCurPicIndex:=FPicList.Count-1;<br>&nbsp; FNext:=True;<br>&nbsp; DoPlayPic;<br>&nbsp; if not temp then Play;<br>end;<br><br>function TTurnWallPaper.CheckIndex:Boolean;<br>begin<br>&nbsp; if FPicList.Count=0 then<br>&nbsp; begin<br>&nbsp; &nbsp; FCurPicIndex:=-1;<br>&nbsp; &nbsp; Result:=False;<br>&nbsp; &nbsp; Exit;<br>&nbsp; end;<br><br>&nbsp; if FNext then<br>&nbsp; begin<br>&nbsp; &nbsp; if FCurPicIndex&gt;=FPicList.Count then<br>&nbsp; &nbsp; &nbsp; FCurPicIndex:=0;<br>&nbsp; &nbsp; {else if FCurPicIndex&lt;=-1 then<br>&nbsp; &nbsp; &nbsp; FCurPicIndex:=FPicList.Count-1; }<br>&nbsp; end<br>&nbsp; else<br>&nbsp; begin<br>&nbsp; &nbsp; if FCurPicIndex&lt;=-1 then<br>&nbsp; &nbsp; &nbsp; FCurPicIndex:=FPicList.Count-1;<br>&nbsp; end;<br>&nbsp; Result:=True;<br>end;<br><br>constructor TTurnWallPaper.Create;<br>begin<br>&nbsp; inherited Create(True);<br>&nbsp; FPicList:=TStringList.Create;<br>&nbsp; FIsPaused:=True;<br>&nbsp; FIsFirst:=True;<br>&nbsp; FIsLast:=True;<br>&nbsp; FCurPicIndex:=-1;<br>&nbsp; Self.Priority:=tpLower;<br>&nbsp; Self.FreeOnTerminate:=False;<br>&nbsp; FNext:=True;<br>&nbsp; FDelay:=15000;<br>end;<br><br>destructor TTurnWallPaper.Destroy;<br>begin<br>&nbsp; FPicList.Free;<br>&nbsp; inherited;<br>end;<br><br>procedure TTurnWallPaper.DoAfterPlayFile;<br>begin<br>&nbsp; if Assigned(FAfterPlayFile) then FAfterPlayFile(Self,FPath);<br>end;<br><br>procedure TTurnWallPaper.DoBeforePlayFile;<br>begin<br>&nbsp; if Assigned(FBeforePlayFile) then FBeforePlayFile(Self,FPath);<br>end;<br><br>procedure TTurnWallPaper.DoPlayPic;<br>begin<br>&nbsp; if CheckIndex then<br>&nbsp; begin<br>&nbsp; &nbsp; FPath:=FPicList[FCurPicIndex];<br>&nbsp; &nbsp; if not FileExists(FPath) then Exit;<br>&nbsp; &nbsp; if ((UpperCase(ExtractFileExt(FPicList[FCurPicIndex])))='.JPG') or (UpperCase(ExtractFileExt(FPicList[FCurPicIndex]))='.JPEG') then<br>&nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; FPath:=ChangeFileExt(FPicList[FCurPicIndex],'.BMP');<br>&nbsp; &nbsp; &nbsp; JPEG2BMP(FPicList[FCurPicIndex]);<br>&nbsp; &nbsp; end;<br><br>&nbsp; &nbsp; Synchronize(DoBeforePlayFile);<br>&nbsp; &nbsp; SetWallpaper(FPath);<br>&nbsp; &nbsp; Synchronize(DoAfterPlayFile);<br>&nbsp; end;<br>end;<br><br>procedure TTurnWallPaper.Execute;<br>var<br>&nbsp; I:Integer;<br>begin<br>&nbsp; while not Self.Terminated do<br>&nbsp; begin<br>&nbsp; &nbsp; while not Self.Suspended do<br>&nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; if Self.Terminated then Exit;<br>&nbsp; &nbsp; &nbsp; FNext:=True;<br>&nbsp; &nbsp; &nbsp; Inc(FCurPicIndex);<br>&nbsp; &nbsp; &nbsp; DoPlayPic;<br>&nbsp; &nbsp; &nbsp; if Self.Terminated then Exit;<br>&nbsp; &nbsp; &nbsp; if Self.Suspended then Break;<br>&nbsp; &nbsp; &nbsp; Application.ProcessMessages;<br><br>&nbsp; &nbsp; &nbsp; for I:=0 to FDelay div 500 do<br>&nbsp; &nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; &nbsp; if (not Self.Suspended) and (not Self.Terminated) then Sleep(500);<br>&nbsp; &nbsp; &nbsp; &nbsp; if Self.Terminated then Exit;<br>&nbsp; &nbsp; &nbsp; &nbsp; //if not Self.Suspended then Break;<br>&nbsp; &nbsp; &nbsp; &nbsp; Application.ProcessMessages;<br>&nbsp; &nbsp; &nbsp; end;<br>&nbsp; &nbsp; &nbsp; if Self.Terminated then Exit;<br>&nbsp; &nbsp; &nbsp; //if not Self.Suspended then Break;<br>&nbsp; &nbsp; &nbsp; Application.ProcessMessages;<br>&nbsp; &nbsp; end;<br>&nbsp; &nbsp; Sleep(300);<br>&nbsp; &nbsp; Application.ProcessMessages;<br>&nbsp; end;<br>end;<br><br>procedure TTurnWallPaper.Pause;<br>begin<br>&nbsp; Self.Suspend;<br>&nbsp; FIsPaused:=True;<br>end;<br><br>procedure TTurnWallPaper.PicList(List: TStrings);<br>var<br>&nbsp; temp:Boolean;<br>begin<br>&nbsp; temp:=FIsPaused;<br>&nbsp; Pause;<br>&nbsp; FPicList.Assign(List);<br>&nbsp; FCurPicIndex:=-1;<br>&nbsp; if List.Count&gt;0 then &nbsp; PlayNext;<br><br>&nbsp; if not temp then Play;<br>end;<br><br>procedure TTurnWallPaper.Play;<br>begin<br>&nbsp; Self.Resume;<br>&nbsp; FIsPaused:=False;<br>end;<br><br>procedure TTurnWallPaper.PlayNext;<br>begin<br>&nbsp; FNext:=True;<br>&nbsp; Inc(FCurPicIndex);<br>&nbsp; DoPlayPic;<br>end;<br><br>procedure TTurnWallPaper.PlayPrior;<br>begin<br>&nbsp;FNext:=False;<br>&nbsp;Dec(FCurPicIndex);<br>&nbsp;DoPlayPic;<br>end;<br><br>procedure TTurnWallPaper.SetDelay(const Value: Integer);<br>begin<br>&nbsp; if Value&lt;=6 then<br>&nbsp; &nbsp; FDelay:=6<br>&nbsp; else<br>&nbsp; &nbsp; FDelay := Value;<br>end;<br><br>procedure TTurnWallPaper.SetWallpaper(path: string);<br>begin<br>&nbsp; SetWallpaperExt(path,wpsSizeToFit,0,0);<br>end;<br><br>end.
 
后退
顶部