sfile:=....\*.ttf;
filename:=extractfilepath(ParamStr(0))+*.ttf;
if not copyfile(pchar(sfile),pchar(filename),false) then
   showmessage('failure!');

解决方案 »

  1.   

    API函数SHGetSpecialFolderLocation可以获得系统中特定文件夹(如我的文档、字体、IE临时文件夹)所在的具体目录,范例:
    uses ShlObj, ActiveX, ComObj;
    ...
    procedure TForm1.Button1Click(Sender: TObject);
    var
      IObject    : IUnknown;
      ISLink     : IShellLink;
      IPFile     : IPersistFile;
      PIDL       : PItemIDList;
      InFolder   : array[0..MAX_PATH] of Char;
      TargetName : String;
      LinkName   : WideString;
    begin
      TargetName := 'c:\windows\calc.exe';  {Use TargetName:=ParamStr(0) which
      returns the path and file name of the
      executing program to create a link to your
      Application}  IObject := CreateComObject(CLSID_ShellLink);
      ISLink  := IObject as IShellLink;
      IPFile  := IObject as IPersistFile;  with ISLink do begin
        SetPath(pChar(TargetName));
        SetWorkingDirectory
       (pChar(ExtractFilePath(TargetName)));
      end;  // if we want to place a link on the Desktop
      SHGetSpecialFolderLocation
         (0, CSIDL_DESKTOPDIRECTORY, PIDL);
      SHGetPathFromIDList
         (PIDL, InFolder);  {
       or if we want a link to appear in
       some other, not-so-special, folder:
       InFolder := 'c:\SomeFolder'
      }  LinkName := InFolder + '\Delphi Created Link.lnk';
      IPFile.Save(PWChar(LinkName), false);
    end;
      

  2.   

    上面的范例是在桌面上建立一个快捷方式,其中:
    SHGetSpecialFolderLocation
         (0, CSIDL_DESKTOPDIRECTORY, PIDL);
      SHGetPathFromIDList
         (PIDL, InFolder);是获得桌面文件夹所在的路径。
      

  3.   

    虽然盘符不一样。但font文件夹的相对路径应该是相同的。那么只需要得当前系统盘符+font文件的路径可以了啊。在把那个文件拷贝到新组成的路径下就行了。