吾爱破解 - 52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 9123|回复: 23
收起左侧

[原创工具] chrome 缓存目录设置软件

  [复制链接]
xtpyeihc 发表于 2015-4-5 21:23
        众所周知的原因,chrome不能设置它的临时文件目录,安装时也不能选择,默认C盘 C:\Users\用户名\AppData\Local\Google\Chrome\User Data\Default\下,有些朋友硬盘分区时把C盘空间分的较少,临时文件一多的话空间够呛,有几年前我就把这个小软件写出来了,通过符号链接方式进行更改,把默认chrome的路径更改到非系统盘,感兴趣的朋友可以百度一下。
QQ截图20150405211825.jpg
QQ截图20150405211846.jpg
       把源码放出来一下,delphi 写的
[Delphi] 纯文本查看 复制代码
unit Unit1;

interface

uses
   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
   Dialogs, ExtCtrls, Registry, StdCtrls, StrUtils, ShlObj, ActiveX,
   FileCtrl,  Tlhelp32, ShellAPI,IniFiles,Buttons, AdvEdit, AdvEdBtn,
   XPMan, Menus, OleCtrls, SHDocVw, OBFileStore, OBDirectories,
  dxGDIPlusClasses;

const
   SELDIRHELP = 1000;

type
   LINK_FILE_INFO = record
      FileName: array[0..MAX_PATH] of Char; // 目标文件名
      WorkDirectory: array[0..MAX_PATH] of Char; // 工作目录或者起始目录
      IconLocation: array[0..MAX_PATH] of Char; // 图标文件名
      IconIndex: Integer; // 图标索引
      Arguments: array[0..MAX_PATH] of Char; // 程序运行的参数
      Description: array[0..255] of Char; // 快捷方式的描述
      ItemIDList: PItemIDList; // 只供读取使用
      RelativePath: array[0..255] of Char; // 相对目录,只能设置
      ShowState: Integer; // 运行时的窗口状态
      HotKey: Word; // 快捷键
   end;


type
   TForm1 = class(TForm)
      Label1: TLabel;
      Button1: TButton;
      Image1: TImage;
      Label2: TLabel;
      AdvEditBtn1: TAdvEditBtn;
      AdvEditBtn2: TAdvEditBtn;
      PopupMenu1: TPopupMenu;
      Label3: TLabel;
      AdvEditBtn3: TAdvEditBtn;
      Button2: TButton;
      WebBrowser1: TWebBrowser;
      OBFileStore1: TOBFileStore;
      Button3: TButton;
      OBDirectories1: TOBDirectories;
    Button4: TButton;
    Label4: TLabel;
    XPManifest1: TXPManifest;
      procedure FormCreate(Sender: TObject);
      procedure Button1Click(Sender: TObject);
      procedure FormClose(Sender: TObject; var Action: TCloseAction);
      procedure AdvEditBtn2ClickBtn(Sender: TObject);
      procedure AdvEditBtn1ClickBtn(Sender: TObject);
      procedure AdvEditBtn3ClickBtn(Sender: TObject);
      procedure Button2Click(Sender: TObject);
      procedure Button3Click(Sender: TObject);
    procedure Button4Click(Sender: TObject);
    procedure Image1DblClick(Sender: TObject);
   private
      function getdirsize(dir: string; subdir: boolean): longint;
    { Private declarations }
      function DeleteDirectory(NowPath: string): boolean; // 删除整个目录
      procedure RunDosInMemo(const DosApp: string; Tlist: TStringList);
   public
    { Public declarations }
   end;

var
   Form1: TForm1;
   ChromePath: string;
   ChromeCache: string;
   ChromeUserdir: string;

                                //C:\Users\y361\AppData\Local\Google\Chrome\User Data\Default\Cache
implementation

{$R *.dfm}



function CopyDirectory(const Source, Dest: string): boolean;
var
   fo: TSHFILEOPSTRUCT;
begin
   FillChar(fo, SizeOf(fo), 0);
   with fo do
   begin
      Wnd := 0;
      wFunc := FO_COPY;
      pFrom := PChar(Source + #0);
      pTo := PChar(Dest + #0);
      fFlags := FOF_NOCONFIRMATION + FOF_NOCONFIRMMKDIR;
   end;
   Result := (SHFileOperation(fo) = 0);
end;


function RenDirectory(const OldName, NewName: string): boolean;
var
   fo: TSHFILEOPSTRUCT;
begin
   FillChar(fo, SizeOf(fo), 0);
   with fo do
   begin
      Wnd := 0;
      wFunc := FO_RENAME;
      pFrom := PChar(OldName + #0);
      pTo := PChar(NewName + #0);
      fFlags := FOF_NOCONFIRMATION + FOF_SILENT;
   end;
   Result := (SHFileOperation(fo) = 0);
end;

procedure TForm1.RunDosInMemo(const DosApp: string; Tlist: TStringList);
const
  {设置ReadBuffer的大小}
   ReadBuffer = 2400;
var
   Security: TSecurityAttributes;
   ReadPipe, WritePipe: THandle;
   start: TStartUpInfo;
   ProcessInfo: TProcessInformation;
   Buffer: PChar;
   BytesRead: DWord;
   Buf: string;
begin
   Tlist.Clear;
   with Security do
   begin
      nlength := SizeOf(TSecurityAttributes);
      binherithandle := true;
      lpsecuritydescriptor := nil;
   end;
  {创建一个命名管道用来捕获console程序的输出}
   if CreatePipe(ReadPipe, WritePipe, @Security, 0) then
   begin
      Buffer := AllocMem(ReadBuffer + 1);
      FillChar(start, SizeOf(start), #0);
    {设置console程序的启动属性}
      with start do
      begin
         cb := SizeOf(start);
         start.lpReserved := nil;
         lpDesktop := nil;
         lpTitle := nil;
         dwX := 0;
         dwY := 0;
         dwXSize := 0;
         dwYSize := 0;
         dwXCountChars := 0;
         dwYCountChars := 0;
         dwFillAttribute := 0;
         cbReserved2 := 0;
         lpReserved2 := nil;
         hStdOutput := WritePipe; //将输出定向到我们建立的WritePipe上
         hStdInput := ReadPipe; //将输入定向到我们建立的ReadPipe上
         hStdError := WritePipe; //将错误输出定向到我们建立的WritePipe上
         dwFlags := STARTF_USESTDHANDLES or STARTF_USESHOWWINDOW;
         wShowWindow := SW_HIDE; //设置窗口为hide
      end;
      try
      {创建一个子进程,运行console程序}
         if CreateProcess(nil, PChar(DosApp), @Security, @Security, true,
            NORMAL_PRIORITY_CLASS,
            nil, nil, start, ProcessInfo) then
         begin
       {等待进程运行结束}
            WaitForSingleObject(ProcessInfo.hProcess, INFINITE);
        {关闭输出...开始没有关掉它,结果如果没有输出的话,程序死掉了。}
            CloseHandle(WritePipe);
            Buf := '';
        {读取console程序的输出}
            repeat
               BytesRead := 0;
               ReadFile(ReadPipe, Buffer[0], ReadBuffer, BytesRead, nil);
               Buffer[BytesRead] := #0;
               OemToAnsi(Buffer, Buffer);
               Buf := Buf + string(Buffer);
            until (BytesRead < ReadBuffer);
      // SendDebug(Buf);
       {按照换行符进行分割,并在Memo中显示出来}
            while Pos(#10, Buf) > 0 do
            begin
               Tlist.Add(Copy(Buf, 1, Pos(#10, Buf) - 1));
               Delete(Buf, 1, Pos(#10, Buf));
            end;
         end;
      finally
         FreeMem(Buffer);
         CloseHandle(ProcessInfo.hProcess);
         CloseHandle(ProcessInfo.hThread);
         CloseHandle(ReadPipe);
      end;
   end;
end;


function TForm1.DeleteDirectory(NowPath: string): boolean; // 删除整个目录
var
   search: TSearchRec;
   ret: Integer;
   key: string;
begin
   if NowPath[Length(NowPath)] <> '\' then
      NowPath := NowPath + '\';
   key := NowPath + '*.*';
   ret := FindFirst(key, faanyfile, search);
   while ret = 0 do
   begin
      if ((search.Attr and fadirectory) = fadirectory) then
      begin
         if (search.Name <> '.') and (search.Name <> '..') then
            DeleteDirectory(NowPath + search.Name);
      end
      else
      begin
         if ((search.Attr and fadirectory) <> fadirectory) then
         begin
            DeleteFile(NowPath + search.Name);
         end;
      end;
      ret := FindNext(search);
   end;
   FindClose(search);
   removedir(NowPath);
   Result := true;
end;

function BytesToStr(const i64Size: Int64): string;
const
   i64GB = 1024 * 1024 * 1024;
   i64MB = 1024 * 1024;
   i64KB = 1024;
begin
   if i64Size div i64GB > 0 then
      Result := Format('%.2f GB', [i64Size / i64GB])
   else if i64Size div i64MB > 0 then
      Result := Format('%.2f MB', [i64Size / i64MB])
   else if i64Size div i64KB > 0 then
      Result := Format('%.2f KB', [i64Size / i64KB])
   else
      Result := IntToStr(i64Size) + ' Byte(s)';
end;

function getdirsize(dir: string; subdir: boolean): longint;
var
   rec: TSearchRec;
   found: Integer;
begin
   Result := 0;
   if dir[Length(dir)] <> '\' then dir := dir + '\';
   found := FindFirst(dir + '*.*', faanyfile, rec);
   while found = 0 do
   begin
      inc(Result, rec.size);
      if (rec.Attr and fadirectory > 0) and (rec.Name[1] <> '.') and (subdir = true) then
         inc(Result, getdirsize(dir + rec.Name, true));
      found := FindNext(rec);
   end;
   FindClose(rec);
end;


function ProcedureIsExists(AppName: string): boolean;
var
   lppe: TProcessEntry32;
   ssHandle: THandle;
   AppFound, findqq: boolean;
   Wnd: HWND;
begin
   Result := False;
   ssHandle := CreateToolHelp32SnapShot(TH32CS_SNAPALL, 0);
   lppe.dwSize := SizeOf(lppe);
   AppFound := Process32First(ssHandle, lppe);
   while AppFound do
   begin
      //其中lppe.szExefile就是程序名**********************************************
      if UpperCase(ExtractFileName(lppe.szExeFile)) = UpperCase(AppName) then
      begin
         Result := true;
         Exit;
      end;
      AppFound := Process32Next(ssHandle, lppe);
   end;
end;

function KillTask(ExeFileName: string): Integer;
const
   PROCESS_TERMINATE = $0001;
var
   ContinueLoop: boolean;
   FSnapshotHandle: THandle;
   FProcessEntry32: TProcessEntry32;
begin
   Result := 0;
   FSnapshotHandle := CreateToolHelp32SnapShot(TH32CS_SNAPPROCESS, 0);
   FProcessEntry32.dwSize := SizeOf(FProcessEntry32);
   ContinueLoop := Process32First(FSnapshotHandle, FProcessEntry32);

   while Integer(ContinueLoop) <> 0 do
   begin
      if ((UpperCase(ExtractFileName(FProcessEntry32.szExeFile)) =
         UpperCase(ExeFileName)) or (UpperCase(FProcessEntry32.szExeFile) =
         UpperCase(ExeFileName))) then
         Result := Integer(TerminateProcess(
            OpenProcess(PROCESS_TERMINATE,
            BOOL(0),
            FProcessEntry32.th32ProcessID),
            0));
      ContinueLoop := Process32Next(FSnapshotHandle, FProcessEntry32);
   end;
   CloseHandle(FSnapshotHandle);
end;

function GetWindowsVersion: string; //读取操作系统版本
var
   AWin32Version: Extended;
   os: string;
begin
   os := 'WINDOWS';
   AWin32Version := StrToFloat(Format('%d.%d', [Win32MajorVersion,
      Win32MinorVersion]));
   if Win32Platform = VER_PLATFORM_WIN32s then
      Result := os + '32'
   else if Win32Platform = VER_PLATFORM_WIN32_WINDOWS then
   begin
      if AWin32Version = 4.0 then
         Result := os + '95'
      else if AWin32Version = 4.1 then
         Result := os + '98'
      else if AWin32Version = 4.9 then
         Result := os + 'Me'
      else
         Result := os + '9x'
   end
   else if Win32Platform = VER_PLATFORM_WIN32_NT then
   begin
      if AWin32Version = 3.51 then
         Result := os + 'NT 3.51'
      else if AWin32Version = 4.0 then
         Result := os + 'NT 4.0'
      else if AWin32Version = 5.0 then
         Result := os + '2000'
      else if AWin32Version = 5.1 then
         Result := os + 'XP'
      else if AWin32Version = 5.2 then
         Result := os + '2003'
      else if AWin32Version = 6.0 then
         Result := os + 'VISTA'
      else if AWin32Version = 6.1 then
         Result := os + '7'
      else if AWin32Version = 6.2 then
         Result := os + '8'
      else
         Result := os;
   end
   else
      Result := os + '??';

end;

function GetLocalName(): string;
var UserName: PChar;
   size: DWord;
begin
   GetMem(UserName, 255);
   size := 255;
   if Windows.GetUserName(UserName, size) = False then
   begin
      FreeMem(UserName);
      GetLocalName := '';
      Exit;
   end;
   GetLocalName := UserName;
   FreeMem(UserName);
end;

function ChromeInstall: boolean;
begin
   Form1.OBDirectories1.ProgramFiles;
end;



function GetExePath: string;
begin
   Result := ExtractFilePath(Application.ExeName);
end;

function FileSize(FileName: string): Int64;
var
   sr: TSearchRec;
begin
   if FindFirst(FileName, faanyfile, sr) = 0 then
      Result := Int64(sr.FindData.nFileSizeHigh) shl 32 + Int64(sr.FindData.nFileSizeLow)
   else
      Result := 0;
   FindClose(sr);
end;

function FolderSize(FolderName: string): Int64;
var
   sr: TSearchRec;
begin
   Result := 0;

   if RightStr(FolderName, 1) <> '\' then FolderName := FolderName + '\';

   if FindFirst(FolderName + '*.* ', faanyfile, sr) = 0 then
      repeat
         if (sr.Name <> '.') and (sr.Name <> '..') then begin
            Result := Result + FileSize(FolderName + sr.Name);

            if (sr.Attr and fadirectory) <> 0 then
               Result := Result + FolderSize(FolderName + sr.Name + '\');
         end;
      until FindNext(sr) <> 0;

   FindClose(sr);
end;


function TForm1.getdirsize(dir: string; subdir: boolean): longint;
var
   rec: TSearchRec;
   found: Integer;
begin
   Result := 0;
   if dir[Length(dir)] <> '\' then dir := dir + '\';
   found := FindFirst(dir + '*.*', faanyfile, rec);
   while found = 0 do
   begin
      inc(Result, rec.size);
      if (rec.Attr and fadirectory > 0) and (rec.Name[1] <> '.') and (subdir = true) then
         inc(Result, getdirsize(dir + rec.Name, true));
      found := FindNext(rec);
   end;
   FindClose(rec);
end;


function SubString(html, Cstr_L, Cstr_R: string): string;
var
   sPosB, sPosE: Integer;
   Lwhtml, LwCstr_L, LwCstr_R: string;
begin
   Result := '';
   if Trim(html) = '' then
      Exit;
   Lwhtml := LowerCase(html);
   LwCstr_L := LowerCase(Cstr_L);
   LwCstr_R := LowerCase(Cstr_R);
   sPosB := Pos(LwCstr_L, Lwhtml) + Length(LwCstr_L);
   sPosE := PosEx(LwCstr_R, Lwhtml, sPosB);
   if (sPosB < sPosE) and (sPosE > 0) then
      Result := Copy(html, sPosB, sPosE - sPosB);
end;


procedure TForm1.FormCreate(Sender: TObject);
var
   ARegistry: TRegistry;
begin
   try
      ARegistry := TRegistry.Create;
      with ARegistry do
      begin
         RootKey := HKEY_CLASSES_ROOT; //指定根键为HKEY—LOCAL—MACHINE
         if OpenKey('\chromehtml\shell\open\command', False) then
         begin
            ChromePath := ReadString('');
            ChromePath := SubString(ChromePath, '"', '"');
            ChromePath := StringReplace(ChromePath, 'chrome.exe', '', [rfReplaceAll]);
         end;
         if ChromePath <> '' then
         begin
   //"C:\Documents and Settings\Administrator\Local Settings\Application Data\Google\Chrome\Application\chrome.exe"
            AdvEditBtn1.Text := ChromePath;
            if (GetWindowsVersion = 'WINDOWS7') or (GetWindowsVersion = 'WINDOWS8') then
               ChromeCache := 'C:\Users\' + GetLocalName + '\AppData\Local\Google\Chrome\User Data\Default\Cache' else
               if (GetWindowsVersion = 'WINDOWSXP') or (GetWindowsVersion = 'WINDOWS2000') then
                  ChromeCache := 'C:\Documents and Settings\' + GetLocalName + '\Local Settings\Application Data\Google\Chrome\User Data\Default\Cache' else
                  ChromeCache := '';
            if ChromeCache <> '' then
               AdvEditBtn2.Text := BytesToStr(getdirsize(ChromeCache, False));
            ChromeUserdir := Copy(ChromeCache, 1, Pos('\Default\Cache', ChromeCache) - 1);
            WebBrowser1.Navigate('http://www.t522.com/tongji/chromeinfo.html');
         end else
            Application.MessageBox('未安装chrome或读取安装路径失败!Win7用户请允许本程序取得管理员权限。',
               '极点博客提示', MB_OK + MB_ICONWARNING + MB_DEFBUTTON2);

         Exit;
      end;
   finally
      ARegistry.Free;
   end;
end;


function SelectDirCB(Wnd: HWND; uMsg: UINT; lParam,
   lpData: lParam): Integer stdcall; //这个是回调函数
begin
   if (uMsg = BFFM_INITIALIZED) and (lpData <> 0) then
      SendMessage(Wnd, BFFM_SETSELECTION, Integer(true), lpData);
   Result := 0;
end;

function SelectDirectory(const Caption: string;
   const Root: WideString; var Directory: string): boolean;
var
   WindowList: Pointer;
   BrowseInfo: TBrowseInfo;
   Buffer: PChar;
   OldErrorMode: Cardinal;
   RootItemIDList, ItemIDList: PItemIDList;
   ShellMalloc: IMalloc;
   IDesktopFolder: IShellFolder;
   Eaten, Flags: LongWord;
begin
   Result := False;
   if not DirectoryExists(Directory) then
      Directory := '';
   FillChar(BrowseInfo, SizeOf(BrowseInfo), 0);
   if (ShGetMalloc(ShellMalloc) = S_OK) and (ShellMalloc <> nil) then
   begin
      Buffer := ShellMalloc.Alloc(MAX_PATH);
      try
         RootItemIDList := nil;
         if Root <> '' then
         begin
            SHGetDesktopFolder(IDesktopFolder);
            IDesktopFolder.ParseDisplayName(Application.Handle, nil,
               POleStr(Root), Eaten, RootItemIDList, Flags);
         end;
         BrowseInfo.ulFlags := BIF_RETURNONLYFSDIRS or BIF_NEWDIALOGSTYLE or BIF_EDITBOX; //BIF_NEWDIALOGSTYLE , BIF_EDITBOX
      // 分别是添加新建文件夹按钮、路径对话框         delphi默认只有 BIF_RETURNONLYFSDIRS
         with BrowseInfo do
         begin
            hwndOwner := Application.Handle;
            pidlRoot := RootItemIDList;
            pszDisplayName := Buffer;
            lpszTitle := PChar(Caption);
         end;

         if Directory <> '' then
         begin
            BrowseInfo.lpfn := SelectDirCB;
            BrowseInfo.lParam := Integer(PChar(Directory));
         end;
         WindowList := DisableTaskWindows(0);
         OldErrorMode := SetErrorMode(SEM_FAILCRITICALERRORS);
         try
            ItemIDList := ShBrowseForFolder(BrowseInfo);
         finally
            SetErrorMode(OldErrorMode);
            EnableTaskWindows(WindowList);
         end;
         Result := ItemIDList <> nil;
         if Result then
         begin
            ShGetPathFromIDList(ItemIDList, Buffer);
            ShellMalloc.Free(ItemIDList);
            Directory := Buffer;
         end;
      finally
         ShellMalloc.Free(Buffer);
      end;
   end;
end;



procedure TForm1.Button1Click(Sender: TObject);
var
   reg: TRegistry;
   OldPach, oldpach1: string;
   NewPach: string;
   cacheSize: string;
   icache: Integer;
   Tlist: TStringList;
   InI:TIniFile;
begin
   try
      reg := TRegistry.Create;
      Tlist := TStringList.Create;
      reg.RootKey := HKEY_CLASSES_ROOT;
      if reg.OpenKey('\ChromeHTML\shell\open\command', False) then
      begin
         oldpach1 := reg.ReadString('');
         if oldpach1 <> '' then
         begin
            if ProcedureIsExists('chrome.exe') then
            begin
               Application.MessageBox('Google Chrome正在运行,最后一步必须结束Chrome进程才能修改!' + #10#13 + '请点击确定', '极点博客提示',
                  MB_OK + MB_ICONINFORMATION);
            KillTask('chrome.exe');
            Sleep(2000);
            end;
             if AdvEditBtn3.Text <> '' then
            begin
             reg.RootKey := HKEY_CURRENT_USER;
               if reg.OpenKey('\Software\Sysinternals\Junction', true) then
               begin
                  reg.WriteBool('EulaAccepted', true);
               end;
               if reg.ReadBool('EulaAccepted') then
               begin
                  InI:=TIniFile.Create(AdvEditBtn3.Text+'\jdrjset.ini');
                  OldPach:=ini.ReadString('SET','oldfile','');
                  if OldPach= AdvEditBtn3.Text then
                  begin
                    Application.MessageBox('已经修改过chrome浏览器缓存路径!',
                        '极点博客提示', MB_OK + MB_ICONINFORMATION);
                     Exit;
                  end else
                  begin

                  CopyDirectory(ChromeUserdir,GetExePath+'ChromeUserBak');
                  RenDirectory(ChromeUserdir, ChromeUserdir + '_bak');
                  OBFileStore1.Files[0].SaveToFile(GetExePath + 'junction.exe');
                  DeleteDirectory(ChromeUserdir);
                  RunDosInMemo(PChar('junction "' + ChromeUserdir + '" ' + '"' + AdvEditBtn3.Text + '"'), Tlist);
                  if Pos('Error creating', Tlist.Text) > 0 then
                  begin
                     RenDirectory(ChromeUserdir + '_bak', ChromeUserdir);
                     Application.MessageBox('已经修改过chrome浏览器缓存路径!',
                        '极点博客提示', MB_OK + MB_ICONINFORMATION);
                     Exit;
                  end
                  else
                     if Pos('Targetted at', Tlist.Text) > 0 then
                     begin
                        CopyDirectory(ChromeUserdir + '_bak\*.*', AdvEditBtn3.Text + '\');
                        DeleteDirectory(ChromeUserdir + '_bak');
                        InI.WriteString('SET','oldfile',AdvEditBtn3.Text);
                        Application.MessageBox('修改Google chrome浏览器缓存路径成功!',
                           '极点博客提示', MB_OK + MB_ICONINFORMATION);
                     end;
               end;
               end;
            end else
            begin
               Application.MessageBox('请先设置chrome缓存目录的新目录。', '极点博客提示',
                  MB_OK + MB_ICONWARNING + MB_DEFBUTTON2);
               Exit;
            end;
         end else
         begin
            Application.MessageBox('未安装chrome或读取安装路径失败!Win7用户请允许本程序取得管理员权限。',
               '极点博客提示', MB_OK + MB_ICONWARNING + MB_DEFBUTTON2);
            Exit;
         end;

      end else
         Application.MessageBox('未安装chrome或读取安装路径失败!Win7用户请允许本程序取得管理员权限。',
            '极点博客提示', MB_OK + MB_ICONWARNING + MB_DEFBUTTON2);
      Exit;
   finally
      DeleteFile(GetExePath + 'junction.exe');
      Tlist.Free;
      InI.Free;
   end;
end;








function Get_S_name(const FileName: string): string;
var
   Tmp_name: array[0..255] of Char;
begin
   if GetShortPathName(PChar(FileName), Tmp_name, SizeOf(Tmp_name) - 1) = 0 then
      Result := FileName
   else
      Result := StrPas(Tmp_name);
end;

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
//KillTask('cmd.exe');
end;

procedure TForm1.AdvEditBtn2ClickBtn(Sender: TObject);
begin
   if ProcedureIsExists('chrome.exe') then
   begin
      case Application.MessageBox('Chrome浏览器正在运行,是否结束该进程?',
         '极点博客提示', MB_OKCANCEL + MB_ICONQUESTION) of
         IDOK:
            begin
               KillTask('chrome.exe');
               Sleep(2000);
               DeleteDirectory(ChromeCache);
               AdvEditBtn2.Text := BytesToStr(getdirsize(ChromeCache, true))
            end;
         IDCANCEL:
            begin
               DeleteDirectory(ChromeCache);
               AdvEditBtn2.Text := BytesToStr(getdirsize(ChromeCache, true))
            end;
      end;
   end else
   begin
      DeleteDirectory(ChromeCache);
      AdvEditBtn2.Text := BytesToStr(getdirsize(ChromeCache, true))
   end;
end;

procedure TForm1.AdvEditBtn1ClickBtn(Sender: TObject);
begin
   WinExec(PChar('cmd.exe /c start ' + Get_S_name(ChromePath)), SW_HIDE);
end;

procedure TForm1.AdvEditBtn3ClickBtn(Sender: TObject);
var
   NewDir: string;
begin
   if SelectDirectory('请选择Chorme浏览器缓存新路径', '', NewDir) then
      AdvEditBtn3.Text := NewDir;
end;


procedure TForm1.Button2Click(Sender: TObject);
begin
 close;

end;

procedure TForm1.Button3Click(Sender: TObject);
begin

   ShellExecute(Handle, 'open', PChar(AdvEditBtn1.Text+'chrome.exe'), PChar('http://www.t522.com'), nil, sw_shownormal); //指定打开网页
end;


procedure TForm1.Button4Click(Sender: TObject);
begin
Application.MessageBox('提示信息,重要!!!' + #13#10#13#10 +
  '本软件是通过修改windows系统的符号链接(具体百度)' + #13#10 +
  '来修改chrome的缓存路径,为了兼容xp,通过另外文件' + #13#10 + '来修改。' +
  #13#10 + '设置chrome新缓存目录前请打开chrome设置(扳手图标)' + #13#10 + 
  '再把鼠标往下拉,点开显示高级设置,最下面的系统,' + #13#10 + 
  '去掉 关闭 Google Chrome 后继续运行后台应用 前面的' + #13#10 + 
  '选框,不然会导致本软件设置后丢失收藏夹等数据,如' + #13#10 + 
  '有丢失情况,请自行还原,备份目录在本软件目录下' + #13#10 + 
  'ChromeUserBak里面,请手工复制该目录下所有文件到' + #13#10 +
  '新缓存目录下。', '极点博客提示', MB_OK + MB_ICONWARNING + MB_DEFBUTTON2);



end;

procedure TForm1.Image1DblClick(Sender: TObject);
begin
   ShellExecute(Handle, 'open', PChar(AdvEditBtn1.Text+'chrome.exe'), PChar('http://www.t522.com'), nil, sw_shownormal); //指定打开网页
end;

end.


Project1.zip (462.26 KB, 下载次数: 92)
http://pan.baidu.com/s/1gdJ7hqb


免费评分

参与人数 3威望 +1 热心值 +3 收起 理由
xindong8 + 1 没想到还有用delphi的,赞一个
Hmily + 1 + 1 感谢发布原创作品,吾爱破解论坛因你更精彩.
aofeng + 1 支持开源!

查看全部评分

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

Analysis#K 发表于 2015-4-5 21:53
貌似可以通过MKLINK命令实现,不过用久了感觉就无所谓了{:1_934:}
核客 发表于 2015-4-5 21:37
hyiyang 发表于 2015-4-5 22:00
zhenDL 发表于 2015-4-6 00:53
可以用Symbolic link 來转移
Chrome的Application Cache , Cache , GPUCache , Media Cache 等緩存輕鬆轉移
selina520 发表于 2015-4-6 07:09
屌暴啊 之前找了很久这样的软件
dlzhitongche 发表于 2015-4-6 11:29
谢谢楼主!!
happylllee 发表于 2015-4-6 14:48
谢谢分享。。。。
蓝叶子 发表于 2015-4-6 15:02
实在不明吧是什么意思。。。
JDIY 发表于 2015-4-6 18:27
楼主好厉害!正需要!
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则

返回列表

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-11-25 02:51

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表