Delphi中可以直接访问任何文件啊?!

解决方案 »

  1.   

    我要判断通过opendialog打开的文件在计算机中是否存在?在VB中是这样用的:
    '判断文件是否存在, 存在返回True  (strFileName为绝对路径,含扩展名)
    Public Function FileExist(strFileName As String) As Boolean
          Dim FileSystem As Object
          Set FileSystem = CreateObject("Scripting.FileSystemObject")
          FileExist = FileSystem.FileExists(strFileName)
          Set FileSystem = Nothing
    End Function
      

  2.   

    用OpenDialog打开的文件一定是存在的啊!是在要判断可以用下面的函数:
    function FileExists(const FileName: string): Boolean;
    //Ex:FileExists(opendialog1.Filename);
    对于Opendialog的用法可以这样啊,就不必用到这个函数了:
    if opendialog1.Execute then
      showmessage(opendialog1.filename);