unit DFindRfMain; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls; type TDlgFindRfMain = class(TForm) btnFindRf: TButton; edSrc: TEdit; edResult: TEdit; mmLog: TMemo; procedure btnFindRfClick(Sender: TObject); private { Private declarations } public { Public declarations } end; var DlgFindRfMain: TDlgFindRfMain; implementation uses Tocsg.Path, Tocsg.Files, Tocsg.Registry, Tocsg.Safe, Tocsg.Shell; {$R *.dfm} procedure TDlgFindRfMain.btnFindRfClick(Sender: TObject); var sDocName, sResult, sDir, sRDir, sChk: String; DList: TStringList; FList: TModFileList; i: Integer; // Plf: TParserLinkFile; begin mmLog.Clear; sResult := ''; mmLog.Lines.Add('Step .. 1'); sDocName := Trim(edSrc.Text); if sDocName = '' then begin MessageBox(Handle, PChar('¹®¼­ À̸§À» ÀÔ·ÂÇØÁÖ¼¼¿ä.'), PChar(Caption), MB_ICONWARNING or MB_OK); exit; end; mmLog.Lines.Add('Step .. 2'); sDir := GetWindowsDir; if sDir = '' then exit; mmLog.Lines.Add('Step .. 3'); Guard(DList, TStringList.Create); Guard(FList, TModFileList.Create(TModeFileComparer.Create)); sDir := 'C:\Users\'; ExtrDirFromDir(sDir, DList); mmLog.Lines.Add('Step .. 4'); for i := 0 to DList.Count - 1 do begin sRDir := sDir + DList[i] + '\AppData\Roaming\Microsoft\Windows\Recent\'; mmLog.Lines.Add('RecentPath = ' + sRDir); ExtrModFilesFromDir(sRDir, FList); end; if FList.Count > 0 then begin mmLog.Lines.Add('Step .. 5, RecentFileCount = ' + IntToStr(FList.Count)); try FList.Sort; // if bIgrRB then // sDocName := StrsReplace(sDocName, ['(', ')', '[', ']'], '0'); for i := 0 to FList.Count - 1 do begin // if bIgrRB then // sChk := StrsReplace(CutFileExt(FList[i].sName), ['(', ')', '[', ']'], '0') // else sChk := CutFileExt(FList[i].sFName); if Pos(sChk, sDocName) > 0 then begin sResult := GetTargetExeFromLink(FList[i].sDir + FList[i].sFName); if sResult = '' then continue; // °£È¤ »ç¿ëÀÚ Æú´õ°¡ ÀÌ»óÇϰÔ(?) Ç¥½ÃµÇ´Â °æ¿ì°¡ ÀÖ´Ù.. º¸Á¤ 24_0514 10:09:24 kku // if (sResult <> '') and (Pos('windows\system32\config\systemprofile', sResult.ToLower) > 0) then // begin // mmLog.Lines.Add('º¸Á¤ Àü = ' + sResult); // sResult := StringReplace(sResult, 'windows\system32\config\systemprofile', // Format('Users\%s', [GetUserNameFromReg]), [rfReplaceAll, rfIgnoreCase]); // mmLog.Lines.Add('º¸Á¤ ÈÄ = ' + sResult); // end; if DirectoryExists(sResult) then continue; // Guard(Plf, TParserLinkFile.Create); // if Plf.LoadFromFile(sDir + FList[i].sName) then // begin // Result := GetLfiValueFromCaption(Plf.LfiEntList, 'Base Path'); // if not FileExists(Result) then // Result := ''; // end; mmLog.Lines.Add('Step .. 6, Idx = ' + IntToStr(i)); exit; end; end; // PDFÀÇ °æ¿ì... ¹®¼­ À̸§¿¡ ÆÄÀÏ À̸§ÀÌ ¾Èµé¾î °¡´Â °æ¿ì°¡ ÀÖ´Ù... // PDF ÆÄÀÏ ÃÖ±ÙÆÄÀÏ ³»¿ªÀ» ãÀ» ¼ö ¾ø´Ù¸é ¸Ç ù¹øÂ° ÀÖ´Â PDF ÆÄÀÏÀ» ³Ñ°ÜÁØ´Ù.. 24_0418 15:10:27 kku if Pos('.PDF', sDocName.ToUpper) > 0 then begin for i := 0 to FList.Count - 1 do begin sChk := CutFileExt(FList[i].sFName); if GetFileExt(sChk).ToUpper = 'PDF' then begin sResult := sChk; exit; end; end; end; finally if sResult <> '' then begin edResult.Text := sResult; mmLog.Lines.Add('Step .. 7, Success'); MessageBox(Handle, PChar('¼º°ø'), PChar(Caption), MB_ICONINFORMATION or MB_OK); end; end; end; end; end.