主要代码如下:
1 {*******************************************************} 2 { } 3 { UWSStartupItemPanel } 4 { Mail:[email protected] } 5 { 版权所有 (C) 2009 Unruly Wolf Soft } 6 { } 7 { 版本:0.1.0.8 } 8 { } 9 { 创建日期:2009年11月5日 } 10 { } 11 { 功能: } 12 { 1、启动项管理(完成度99%) } 13 { 2、软件卸载(完成度80%) } 14 {*******************************************************} 15 16 {********************************************************} 17 { 版本升级记录: } 18 { 2009年10月20日:构思控件 } 19 { 2009年10月22日:开始设计控件 } 20 { 2009年10月23日:改进数项功能设计 修复Bug } 21 { 2009年10月24日:0.1.0.0版完成,实现启动项基本管理功能:} 22 { 1、启动项查看 } 23 { 2、删除 } 24 { 3、禁止使用 } 25 { 4、编辑 } 26 { 5、新增启动项 } 27 { 2009年10月27日:完成TUWSUnInstallPanel 组件开发 } 28 { 2009年11月1日:为TUWSStartPanel增加两个事件: } 29 { BeforReload AfterReload } 30 { 2009年11月2日:TUWSUninstallPanel.DelReg完成 } 31 {********************************************************} 32 33 unit UWSStartItemPanel; 34 35 interface 36 37 uses 38 SysUtils, Classes, Controls, ExtCtrls,Graphics,StdCtrls,Forms, 39 StartupItemEditor,ShellAPI,Messages,Registry,Windows,Dialogs, 40 StrUtils,U_ViewCMDInfos; 41 42 const 43 KeyRun= '\SOFTWARE\Microsoft\Windows\CurrentVersion\Run'; 44 KUninstallRegPath = 'Software\Microsoft\Windows\CurrentVersion\Uninstall'; 45 KUninstallString = 'UninstallString'; 46 KDisplayName = 'DisplayName'; 47 KDisplayVersion='DisplayVersion'; 48 KInstallDate='InstallDate'; 49 KInstallLocation='InstallLocation'; 50 KModifyPath='ModifyPath'; 51 KPublisher='Publisher'; 52 KURLInfoAbout='URLInfoAbout'; 53 KDisplayIcon='DisplayIcon'; 54 KQuietUninstallString='QuietUninstallString'; 55 KISAP='Inno Setup: App Path'; 56 57 {TUWSStartupItem} 58 59 type 60 TUWSStartupItem = class(TPanel) 61 private 62 { Private declarations } 63 BtnDel:TButton; 64 BtnForbidden:TButton; 65 BtnEdit:TButton ; 66 BtnViewCMDInfo:TButton ; 67 LabelCaption:TLabel ; 68 ImageIcon:TImage; 69 RealCommandLine:string; 70 FStartItemCaption:String; 71 FCmdLine:String; 72 FStartItemPostion:string; 73 FItemIndex:Integer ; 74 Forbiddened:Boolean ; 75 procedure UpateItem; 76 procedure BuildItemPropeties; 77 procedure CMMouseEnter(var Message: TMessage); message CM_MOUSEENTER; 78 procedure CMMouseLeave(var Message: TMessage); message CM_MOUSELEAVE; 79 protected 80 { Protected declarations } 81 procedure DsItem; 82 public 83 { Public declarations } 84 constructor Create(AOwner: TComponent); override; 85 destructor Destroy; override; 86 property CmdLine:string read FCmdLine write FCmdLine; 87 property StartItemPostion :string read FStartItemPostion write FStartItemPostion; 88 procedure DelStartupItem; 89 procedure ForbiddenStartupItem; 90 procedure EditStartupItem; 91 procedure ViewCMDLineInfo; 92 procedure SetupStartupItem(ItemCaption,ItemCmd,ItemPostion:string); 93 property StartItemCapTion: string read FStartItemCaption write FStartItemCaption; 94 property ItemIndex:integer read FItemIndex write FItemIndex; 95 published 96 { Published declarations } 97 end; 98 99 {TUWSUnInstallItem} 100 101 TUWSUnInstallItem = class(TPanel) 102 private 103 { Private declarations } 104 BtnStandardUnInstall:TButton ; 105 BtnDelRegString:TButton ; 106 BtnForceUnInstall:TButton ; 107 BtnModify:TButton ; 108 BtnQuitUnInstall:TButton ; 109 IconImage:TImage ; 110 FInstallPath:String; 111 FUnInstallCmd:String; 112 FDisplayName:String; 113 FInstallLocation:String; 114 FQuietUninstallCmd:String; 115 FModifyPath:string; 116 FRegKeyName:string; 117 FIsWindowsUpData:Boolean ; 118 procedure SetupItemPropeties; 119 procedure CMMouseEnter(var Message: TMessage); message CM_MOUSEENTER; 120 procedure CMMouseLeave(var Message: TMessage); message CM_MOUSELEAVE; 121 protected 122 { Protected declarations } 123 public 124 { Public declarations } 125 constructor Create(AOwner: TComponent); override; 126 destructor Destroy; override; 127 property InstallPath : string read FInstallPath write FInstallPath; 128 property UnInstallCmd : string read FUnInstallCmd write FUnInstallCmd; 129 property DisplayName : string read FDisplayName write FDisplayName; 130 property IsWindowsUpdata : Boolean read FIsWindowsUpdata write FIsWindowsUpdata; 131 property RegKeyName : string read FRegKeyName write FRegKeyName; 132 property InstallLocation : string read FInstallLocation write FInstallLocation; 133 property QuietUninstallCmd : string read FQuietUninstallCmd write FQuietUninstallCmd; 134 property ModifyPath : string read FModifyPath write FModifyPath; 135 published 136 { Published declarations } 137 procedure DoStandardUnInstall; 138 procedure DoDelUnInstallRegInfo; 139 procedure DoUnInstallAndClearn; 140 procedure DoModify; 141 procedure DoQuietUninstall; 142 end; 143 144 {TUWSStartItemPanel} 145 146 TUWSStartItemPanel = class(TScrollBox) 147 private 148 { Private declarations } 149 ItemList:TStringList; 150 WatchTime:TTimer; 151 ItemChangedTime:TTimer; 152 FMyWatchTime:Cardinal; 153 FAllowautorefresh:Boolean ; 154 FBeforeReload:TNotifyEvent; 155 FAfterReload:TNotifyEvent; 156 function GetItemCount:Integer ; 157 function FindAndBuildStartup(const ADirectoryName: string;SubDirs: TStrings): Boolean; 158 function SearchStartup(const ADirectoryName: string): Boolean; 159 procedure WatchItemOnWatch(Sender:TObject); 160 procedure ItemChangedTimer(Sender:TObject); 161 procedure DelItem(Sender:TObject); 162 procedure EditItem(Sender:TObject); 163 procedure BtnViewInfoClick(Sender:TObject); 164 procedure ForbiddenItem(Sender:TObject); 165 procedure SetWatchTime(aValue:Cardinal); 166 procedure SetAllowautorefresh(aValue:Boolean); 167 protected 168 { Protected declarations } 169 public 170 { Public declarations } 171 constructor Create(AOwner: TComponent); override; 172 destructor Destroy; override; 173 procedure LoadAllStartup; 174 procedure DestroyAllStartupItem; 175 procedure AddNewItem; 176 procedure ReLoadStartItems; 177 procedure MakeForbiddenItemDir; 178 property ItemCount : Integer read GetItemCount; 179 published 180 { Published declarations } 181 property MyWatchTime:Cardinal read FMyWatchTime write SetWatchTime; 182 property Allowautorefresh:Boolean read FAllowautorefresh write SetAllowautorefresh; 183 property BeforeReload : TNotifyEvent read FBeforeReload write FBeforeReload; 184 property AfterReload : TNotifyEvent read FAfterReload write FAfterReload; 185 end; 186 187 {TUWSUnInstallPanel} 188 189 TUWSUnInstallPanel = class(TScrollBox) 190 private 191 { Private declarations } 192 ItemList:TStringList; 193 FShowWinUPs:Boolean ; 194 FShowItemHint:Boolean ; 195 procedure StandardUnInstall(Sender:TObject); 196 procedure UnInstallAndClearn(Sender:TObject); 197 procedure DelReg(Sender:TObject); 198 procedure ModifyInstall(Sender:TObject); 199 procedure StaticUnInstall(Sender:TObject); 200 protected 201 { Protected declarations } 202 public 203 { Public declarations } 204 constructor Create(AOwner: TComponent); override; 205 destructor Destroy; override; 206 procedure LoadAllUnInstallInfos(ShowWinUP:Boolean); 207 procedure ReLoadUnInstallInfos; 208 procedure DestroyUnInstallInfos; 209 procedure SetWinUPVisable; 210 procedure SetShowItemHint; 211 published 212 { Published declarations } 213 property ShowWinUPs : Boolean read FShowWinUPs write FShowWinUPs; 214 property ShowItemHint : Boolean read FShowItemHint write FShowItemHint; 215 end; 216 217 procedure Register; 218 219 implementation 220 221 procedure Register; 222 begin 223 RegisterComponents('uws Used', [TUWSStartItemPanel,TUWSUnInstallPanel]); 224 end; 225 226 {UWSStartupItem} 227 228 procedure TUWSStartupItem.DelStartupItem ; 229 var 230 Reg:TRegistry; 231 RunItemName,RunItemDir,RunItemFile:string; 232 begin 233 begin 234 RunItemName:=FStartItemCaption; 235 RunItemDir:=FStartItemPostion; 236 RunItemFile:=FCmdLine; 237 if DirectoryExists(RunItemDir) then 238 begin 239 if not DeleteFile(PChar(RunItemFile)) then 240 Application.MessageBox(pchar(Format('删除%s失败!!',[RunItemName])), PChar(Application.Title), 241 MB_OK + MB_ICONSTOP + MB_TOPMOST); 242 end 243 else 244 begin 245
-
六六分期app的软件客服如何联系?不知道吗?加qq群【895510560】即可!标题:六六分期
阅读:19227|2023-10-27
-
今天小编告诉大家如何处理win10系统火狐flash插件总是崩溃的问题,可能很多用户都不知
阅读:9996|2022-11-06
-
今天小编告诉大家如何对win10系统删除桌面回收站图标进行设置,可能很多用户都不知道
阅读:8331|2022-11-06
-
今天小编告诉大家如何对win10系统电脑设置节能降温的设置方法,想必大家都遇到过需要
阅读:8700|2022-11-06
-
我们在使用xp系统的过程中,经常需要对xp系统无线网络安装向导设置进行设置,可能很多
阅读:8645|2022-11-06
-
今天小编告诉大家如何处理win7系统玩cf老是与主机连接不稳定的问题,可能很多用户都不
阅读:9667|2022-11-06
-
电脑对日常生活的重要性小编就不多说了,可是一旦碰到win7系统设置cf烟雾头的问题,很
阅读:8630|2022-11-06
-
我们在日常使用电脑的时候,有的小伙伴们可能在打开应用的时候会遇见提示应用程序无法
阅读:8004|2022-11-06
-
今天小编告诉大家如何对win7系统打开vcf文件进行设置,可能很多用户都不知道怎么对win
阅读:8664|2022-11-06
-
今天小编告诉大家如何对win10系统s4开启USB调试模式进行设置,可能很多用户都不知道怎
阅读:7540|2022-11-06
|
请发表评论