怎么样在delphi中判断某一文件夹是否存在?用什么函数实现?
还有就是如何动态创建form  如何将动态创建的form与事件关联起来!谢谢

解决方案 »

  1.   

    if not (DirectoryExists(ExtractFilePath(application.exename)+'\ini')) then
                    mkdir(ExtractFilePath(application.exename)+'\ini');
      

  2.   


      if not FileExists('c:\test') then
        CreateDirectory(Pchar('c:\test'),nil);
      

  3.   

    nil 是什么,是不是‘空’?
      

  4.   

    Function IsNullDir(const DirPath:string):boolean;
    var
    FindData: TWin32FindData;
    hf: THandle;
    path: string;
    begin  if dirpath[length(dirpath)]<>'\' then path:=dirpath+'\'
      else path:=dirpath;  hf := Windows.FindFirstFile(PChar(path + '*.*'), FindData);
      if hf = INVALID_HANDLE_VALUE then
      begin
       result:=false;    //目录不存在返回false
      end
      else 
      begin
      result:=true;
      windows.FindClose(hf);
      end;
    end;