Advertisement
RandomClear

How to get caller information

Jan 30th, 2013
410
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 0.42 KB | None | 0 0
  1. uses
  2.   ECallStack,
  3.   EClasses,
  4.   EDebugInfo;
  5.  
  6. procedure TForm1.Button1Click(Sender: TObject);
  7.  
  8.   procedure Test;
  9.   var
  10.     Caller: Pointer;
  11.     Info: TELLocationInfo;
  12.   begin
  13.     Caller := TEurekaStackList.Caller;
  14.     Info := GetLocationInfo(Caller);
  15.     Label1.Caption := Info.UnitName + '.' + Info.ClassName + '.' + Info.ProcedureName;
  16.     // Will output: 'Unit1.TForm1.Button1Click'
  17.   end;
  18.  
  19. begin
  20.   Test;
  21. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement