var
  tempform:tform;
这个声名是不行的。
type
  tempform = class(TForm)
这样看看可不可以。

解决方案 »

  1.   

    try
        tempform:=aboutform.create(self);//或addform;
        tempform.showmodal;
      finally
        tempform.free;
    =============try
    finally
    它是执行完的,你已把tempform.free掉了
      

  2.   

    tempform?不用它可以嗎?如果可以的話,不用就行了
      

  3.   

    try
        tempform:=aboutform.create(self);//或addform;
        tempform.showmodal;
      finally
        tempform.free;
    少了一个T
    应该为:try
        tempform:=Taboutform.create(self);//或addform;
        tempform.showmodal;
      finally
        tempform.free;
      

  4.   

    Q1:搂上已经给出答案了。另外还存在一种情况,就是你的aboutform本身在程序启动的时候已经创建,因此你使用Taboutform.create(self);是无法创建它的,要判断窗体是否已经被创建,你可以看一下dpr文件中是否已经存在
    Application.createform(aboutform.Taboutform);一句。
    Q2:以下两句的区别只在于当窗体创建的时候其父类是什么,一般的如果窗体是动态创建的,可以直接使用self创建。
    tempform:=aboutform.create(self);
    tempform:=aboutform.create(Application);
    Q3:那一句是对应你的try...finally语句的,因为你使用的是finally,意味着try部分执行完毕之后必须执行free这个操作,但如果窗体是无法正常创建的,那么free的操作就会变成非法操作,所以有这样的warning了。我建议最好用except取代finally。然后利用窗体的modalresult去关闭窗体。