可以定义如下:
unit unit1;
...
procedure Proc1....
  procedure proc2
  begin
    ...
  end;
var ....
begin
...
  proc2;
...
end;若能被其它单元文件调用:
1、其他单元首先uses unit1;
2、unit1中的过程必须声明为全局过程,也就是声明必须放在implementation之前就可以了。

解决方案 »

  1.   


    procedure xxx;
    var
      SU: string;
      procedure xx;
      var
        SLocal: string
      begin
        showmessage(SLocal);
        showmessage(su);
      end;
    begin
      xx;
    end;其中xx为过程内过程。外部过程件不到这个过程,其他单元的过程也看不到。另外过程内部过程不要太长。内部过程比较外部过程慢。如果定义其他单元能访问的全局过程在单元的interface 部分定义过程头
    interface
      uses classes;
    const 
    type
    ...    
      procedure XXXXX;
    implementationprocedure XXXXX;
    begin
    end;
    其它单元访问他 要把过程所在单元名加在自己的uses里行了,你自己要多看书,看代码,delphi的demo多好呀,有的又简单又漂亮。
      

  2.   

    我按照laza  的格式去做,产生编译错误,错误行就在procedure xx 上,
    错误信息显示为 Identifier redeclarcd but 'PROCEDURE' found.
    请帮助我。( 用MDI编程)。
      

  3.   

    這樣就行了。
    procedure xxx;
      procedure xx;
      var
        SLocal: string
      begin
        showmessage(SLocal);
        showmessage(su);
      end;
    var
      SU: string;
    begin
      xx;
    end;