OutputDebugString para debug
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhH5J4FZu8kWE82h1_bsGrZ7e3tNMGcTILoBqqORTJwyABbIj22k3tWhtl2TWXxLlJ94S-ejjyCHEQRzUx0aMNJBb8OZOo_Rk_gYVyXFOcWkdm1xKpgYepZPBOikfxy2-txjUbmHSj8mO4/s200/hombre-lupa_96743-574.jpg)
Vamos começar
O código para isto é bem simples e apenas adicionar o código
procedure TFSistema.DoCreate;
begin
inherited;
OutputDebugString(PWideChar('Conteúdo a ser exibido'));
end;
Com isso o resultado ficara desta forma:
Então que vocês acham de fazer um classe deste método para facilitar ainda mais nossa vida?
unit LogEventsHelper;
interface
uses Windows;
type
TLogEventsHelper = class
public
class procedure LogEvents(const aOutputString: String);
end;
function IsDebuggerPresent: LongBool; external kernel32 name 'IsDebuggerPresent';
implementation
{ TLogEventsHelper }
class procedure TLogEventsHelper.LogEvents(const aOutputString: String);
begin
OutputDebugString(PWideChar(aOutputString));
end;
end.
Desta maneira agora começarmos a utilizar desta maneira:
procedure TFSistema.DoCreate;
begin
inherited;
TLogEventsHelper.LogEvents('Conteúdo a ser exibido');
end;
O Event log fica em menu (View > Debug Windows > Events);
Resultado do OutputDebugString:
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjiS7Rr6qhgLAVJ1_IrdEHVuI-GXqPl5JIRemoa27OqkkDRz72sucBr2Fjdkzb408eRNF7oz3-eETZeCfVxlnrK_AoqDBekCQ8vJwMJKkZ0h2iZQOAtxPmC2OE2gUV79M8SyOClL_5LQZM/s640/0202.gif)
Exemplo: Download do exemplo
0 comentários:
Postar um comentário