Jump to content
uniGUI Discussion Forums
jaromir

Active form class name / caption / name

Recommended Posts

Hello,

Is it possible to know actual (topmost) window name / class name / caption ?

I'm hook my debug email system at DMServer.OnException and I want to know which app window has problem..

Thanks

Share this post


Link to post
Share on other sites
53 minutes ago, jaromir said:

Is it possible to know actual (topmost) window name / class name / caption ?

Hello,

For what purpose? Please explain.

Share this post


Link to post
Share on other sites

As described above. I send debug e-mail from OnException server module event handler. In this e-mail I want to put window name / class name where exception was raised.

Is it clear ?

Share this post


Link to post
Share on other sites

I made this this way. But this is workaround.

I'm pretty sure that better way exists.

  TDMMain = class(TUniGUIMainModule)
  private
    { Private declarations }
    fLastFormInstanceClassName: String;
  public
    { Public declarations }
    function GetFormInstance(const InClass: TClass): TComponent;
  end;
  
function TDMMain.GetFormInstance(const InClass: TClass): TComponent;
begin
  fLastFormInstanceClassName := InClass.ClassName;
  Result := inherited GetFormInstance(InClass);
end;

  TDMServer = class(TUniGUIServerModule)
    procedure UniGUIServerModuleException(Sender: TUniGUIMainModule; AException: Exception;
      var Handled: Boolean);
  end;
  
procedure TDMServer.UniGUIServerModuleException(Sender: TUniGUIMainModule; AException: Exception;
  var Handled: Boolean);
begin
  SendEmailMessage(DMMain.LastFormInstanceClassName, AException.ClassName, AException.Message);
end;  

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×