delphi ShowDebugInfo 窗口


本文整理自网络,侵删。

 
//调用 ShowDebugInfo('登录成功了','登录成功了');


unit uDebug;

interface

uses
  windows, Forms, StdCtrls, Controls, SysUtils;

type

  TOnDispDebugMsg = procedure(AMsg: string) of object;

procedure ShowDebugInfo(Title: string; Info: string);
procedure OutDbgMsg(AMsg: string; Value: integer); overload;
procedure OutDbgMsg(AMsg: string; Value: Cardinal); overload;
procedure OutDbgMsg(AMsg: string; Value: boolean); overload;
procedure OutDbgMsg(AMsg: string; Value: string); overload;

procedure SetOnDispDebugMsg(AOnDispDebugMsg: TOnDispDebugMsg);
procedure DispDebugMsg(AMsg: string);

implementation

var
  OnDispDebugMsg: TOnDispDebugMsg;

procedure ShowDebugInfo(Title: string; Info: string);
var
  Frm: TForm;
  Memo: TMemo;
begin

  Frm := TForm.Create(nil);
  Memo := TMemo.Create(Frm);

  with Frm do
  begin
    Left := 100;
    Top := 100;
    Caption := Title;
  end;

  with Memo do
  begin
    Parent := Frm;
    Align := alClient;
    Font.Size := 11;
    Font.Charset := GB2312_CHARSET;
    Font.Name := '宋体';
    Text := Info;
    ScrollBars := ssBoth;
  end;

  try
    Frm.ShowModal();
  finally
    Frm.Free();
  end;
end;

procedure OutDbgMsg(AMsg: string; Value: integer);
var
  sTemp: string;
begin
  AMsg := AMsg + ':';
  sTemp := inttostr(Value);
  OutputDebugString(pchar(AMsg + sTemp));
end;

procedure OutDbgMsg(AMsg: string; Value: Cardinal);
var
  sTemp: string;
begin
  AMsg := AMsg + ':';
  sTemp := inttostr(Value);
  OutputDebugString(pchar(AMsg + sTemp));
end;

procedure OutDbgMsg(AMsg: string; Value: boolean); overload;
var
  sTemp: string;
begin
  AMsg := AMsg + ':';

  if Value then
    sTemp := 'True'
  else
    sTemp := 'False';
  OutputDebugString(pchar(AMsg + sTemp));

end;

procedure OutDbgMsg(AMsg: string; Value: string);

begin
  AMsg := AMsg + ':';
  OutputDebugString(pchar(AMsg + Value));
end;

procedure SetOnDispDebugMsg(AOnDispDebugMsg: TOnDispDebugMsg);
begin
  OnDispDebugMsg := AOnDispDebugMsg;
end;

procedure DispDebugMsg(AMsg: string);
begin
  if Assigned(OnDispDebugMsg) then
    OnDispDebugMsg(AMsg);
end;

end.

相关阅读 >>

Delphi 工程判断内存溢出reportmemoryleaksonshutdown := true;

Delphi编程时按回车键无效,无法换行解决办法

Delphi判断当前用户是否为管理员

Delphi中webbrowser(或者embeddedwebbrowser)控件打开部分网站报“invalid floating point operation”异常的解决方法

Delphi tcomport控件从串品读取数据

Delphi配置文件ini

Delphi webbrowser有关技术

Delphi字符串隐藏

Delphi开机启动项管理源码

Delphi winapi: movewindow - 改变窗口的位置与大小

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...