你是不是那个控件没又create的就使用了,或者是那个事件直接或间接调用了自身了?

解决方案 »

  1.   

    还有可能是,你form在project中create了一次,在程序中又create了一次,那样会出现类似得错误。
      

  2.   

    这种问题的出现原因很多,一种是程序代码的问题,但如果第二次运行就可以了,那么可能跟代码没关系;另一种情况是delphi自身的原因,也就是莫名的错误了,没有办法解决(以前我碰到这种情况只好重启动delphi)。还有就是病毒的原因,好好查一下吧
      

  3.   

     
      http://www.bjlongway.com/BoundsChecker-Delphi.htm,解决内存  
      

  4.   

    to passos(古月春秋):
      我调试过了,可是搞不明白。
    是这样:
    使用mkdir建路径
    var
      intbtn:integer;
      dest_dir.source_dir:string;
        try
          MkDir('c:\aa');
         except
        end;
        dest_dir:=c:\aa
        source_dir:=d:\bb\xx.ini;
        intBtn:=FindFirst(source_dir,faAnyFile,SearchRec);
        while intBtn=0 do {Length(SearchRec.Name)>0) do}
        BEGIN
         source_name:=source_dir+SearchRec.Name;
          dest_name:=dest_dir+SearchRec.Name;
          if FileExists(dest_name)=False then
          begin
            fn_source:=FileOpen(source_name,0);
          if (fn_source<0) then
          begin
              Application.MessageBox('打开文件错!','错误',MB_OK+MB_ICONSTOP);
              Exit;
            end;
          fn_dest:=FileCreate(dest_name);
            if fn_dest<0 then
          begin
              FileClose(fn_source);
              Application.MessageBox('创建文件错!','错误',MB_OK+MB_ICONSTOP);
              Exit;
            end;
            data_count:=FileRead(fn_source,AChrNull,1024);
          FileWrite(fn_dest,AChrNull,data_count);
           FileClose(fn_source);
          FileClose(fn_dest);
          end;
          intBtn:=FindNext(SearchRec);
        END;
      end;
    当目标文件存在时不出错
    不存在时,出错。为何?错误提示在上。
      

  5.   

    你有没有看过帮助啊
      Note: FindFirst allocates resources (memory) which must be released by calling FindClose. 
    你在何出调用的 FindClose 来释放内存的
    再说 FindFirst 参数中用的SearchRec也没定义啊
      

  6.   

    To csdn72:
      不好意思,定义在这里我略去了。对不起!
    我按你说的在while语句后加上了'FindClose(searchRec);'还是不对。错误照常出现。
    当目标文件存在时不出错
    不存在时,出错。我还是不明白?????请指教...
    解决后一定加分,决不食言。
      

  7.   

    你的程序是真难读啊,我是没明白你要做什么
      source_name:=source_dir+SearchRec.Name你忘了在中间加‘\’,所以FileOpen(source_name,0);肯定会返回小于0的数
    而且你的while循环也有问题,如果FindFirst(source_dir,faAnyFile,SearchRec);没找到目标文件,FindNext也不会执行到了
    清你把代码完整的贴一份上来,我帮你仔细看一下