TButton Button1;
...
if Assigned(Button1) then
begin
....
end   里头的Asssigned()在CBuilder里头怎么表示啊

解决方案 »

  1.   

    Button1只是一个指针,在CB里其值只要不是NULL就是有效的。TButton *Button1
    ...
    if(Button1)
    {
     ...
    }
      

  2.   

    TButton *Button;
    Button = new TButton(Form1);
    delete Button;
    if(Button)
    {
        .....
    }
    ....
    楼上的朋友,如果这样。。,恐怕就有问题哦。
      

  3.   

    这些都是DELHI的语法格式吗???为什么我看不明白....Assigned函数我经常用过.是用来判断一个指针是否为有效(空值);
    比如:
     IF Not Assigned(Form1) Then Application.CreateForm(Form1, TForm1);
     Form1.Show;注:如果不在Form1的ONClose或者OnDestroy里写上一行代码: Form1:= Nil;那么,当Form1释放之后,再次去执行上述的代码时,第二行会出错.
      

  4.   

    TButton *Button1=NULL;
    ...
    if(Button1)
    {
     ...
    }
      

  5.   

    TButton *Button;
    Button = new TButton(Form1);
    delete Button;
    Button =NULL;//最好加上
      

  6.   

    每次注销一个指针变量后
    最好再赋一个空值..CB 中  Button1 = NULL;
    DELPHI 中 Button1 := NIL;