Addr 함수 - 객체 가져오기 포인터

760 단어 add


procedure TForm1.FormCreate(Sender: TObject);

var

  Str: string;

  pStr: PString;

begin

  Str := 'Delphi 2007';

  pStr := @Str;       {  @     }

  ShowMessage(pStr^); {Delphi 2007}



  Str := 'Delphi 2008';

  pStr := Addr(Str);  {Addr   @        ,       }

  ShowMessage(pStr^); {Delphi 2008}





  {   Form1    }

  ShowMessage(IntToStr(Integer(@Self)));          {1244648;      }

  ShowMessage(IntToStr(Integer(Addr(Self))));     {1244648}



  {   Form1   FormCreate      }

  ShowMessage(IntToStr(Integer(@OnCreate)));      {4570956}

  ShowMessage(IntToStr(Integer(Addr(OnCreate)))); {4570956}



  {

                     ,   @      ;

           Addr,           ,        ...

  }

end;


 
   

좋은 웹페이지 즐겨찾기