⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mainunit.pas

📁 一个小的Delphi的QQ消息浏览工具
💻 PAS
字号:
unit MainUnit;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, WinSkinData, StdCtrls, ComCtrls, ImgList,QQMSG, Grids, Buttons, Mask,
  DBCtrls, DBGrids, ToolWin, ExtCtrls;

type
  TMainForm = class(TForm)
    SkinData1: TSkinData;
    OpenDialog1: TOpenDialog;
    ImageList1: TImageList;
    ToolBar1: TToolBar;
    ToolButton1: TToolButton;
    ToolButton2: TToolButton;
    ToolButton3: TToolButton;
    Panel1: TPanel;
    TreeView1: TTreeView;
    Splitter1: TSplitter;
    Panel2: TPanel;
    ToolButton4: TToolButton;
    ToolButton5: TToolButton;
    Memo1: TMemo;
    SaveDialog1: TSaveDialog;
    ToolButton6: TToolButton;
    ToolButton7: TToolButton;
    procedure FormCreate(Sender: TObject);
    procedure TreeView1Change(Sender: TObject; Node: TTreeNode);
    procedure ToolButton3Click(Sender: TObject);
    procedure ToolButton1Click(Sender: TObject);
    procedure ToolButton5Click(Sender: TObject);
    procedure ToolButton7Click(Sender: TObject);
  private
    { Private declarations }
    C2CMsgNodeRoot,SysMsgNodeRoot,DiscMsgNodeRoot,GroupMsgNodeRoot,TempSessionMsgNodeRoot,MobileMsgNodeRoot:TTreeNode;
    QQMSG:TQQMSG;
  public
    { Public declarations }
    procedure ShowMsg(filename:string;QQnum:string);
  end;

var
  MainForm: TMainForm;

implementation

{$R *.dfm}
  uses QQNumView;
procedure TMainForm.ToolButton1Click(Sender: TObject);
begin
  FindQQNum.FindQQ;
  FindQQNum.ShowModal;
end;

procedure TMainForm.ToolButton3Click(Sender: TObject);
var
  filename:string;
  QQnum:string;
  i:Integer;

begin
  filename:='';
  QQnum:='';
  OpenDialog1.Filter:='QQ消息文件(MsgEx.db)|MsgEx.db' ;
  if OpenDialog1.Execute(Handle) then
  begin
    filename:=OpenDialog1.FileName;
    if filename<>'' then
    begin

      QQnum:=InputBox('QQ消息浏览器','输入QQ号码','');
      if QQnum='' then
      begin
       Exit;
      end;
      ShowMsg(filename,QQnum);

    end;
  end;
end;

procedure TMainForm.ToolButton5Click(Sender: TObject);
var
  savepath:string;
begin
  savepath:='';
  SaveDialog1.Filter:='文本文件(*.txt)|*.txt';
  if SaveDialog1.Execute(Handle)then 
  begin
    savepath:=SaveDialog1.FileName;
    if savepath<>'' then
      Memo1.Lines.SaveToFile(savepath+'.txt');  
  end;
end;

procedure TMainForm.ToolButton7Click(Sender: TObject);
begin
Application.MessageBox('QQ:3203057' + #13#10#13#10 + 
  '注:本人仅是测试Delphi版的TEA填充算法可用性,纯技术研究,' + #13#10 +
  '并没有对TC产品做任何逆向分析,不承担任何法律责任!' + #13#10#13#10 + 
  '2008-12-04', '关于', MB_OK + MB_ICONINFORMATION + MB_DEFBUTTON2);
  
end;

procedure TMainForm.ShowMsg(filename:string;QQnum:string);
var
  i:Integer;
  SubNode:TTreeNode;
begin
      Self.Caption:='QQ消息浏览器-'+ QQnum;
      QQMSG.Free;
      QQMSG:=TQQMSG.Create(filename,QQnum);

      TreeView1.Items.Clear;
      FormCreate(nil);

      for i := 0 to QQMSG.C2CMsgList.Count - 1 do
      begin
        SubNode:=TreeView1.Items.AddChild(C2CMsgNodeRoot,QQMSG.C2CMsgList.Strings[i]);
        SubNode.ImageIndex:=0;
        SubNode.SelectedIndex:=0;
      end;
      for i := 0 to QQMSG.SysMsgList.Count - 1 do
      begin
        SubNode:=TreeView1.Items.AddChild(SysMsgNodeRoot,QQMSG.SysMsgList.Strings[i]);
        SubNode.ImageIndex:=1;
        SubNode.SelectedIndex:=1;
      end;
      for i := 0 to QQMSG.DiscMsgList.Count - 1 do
      begin
        SubNode:=TreeView1.Items.AddChild(DiscMsgNodeRoot,QQMSG.DiscMsgList.Strings[i]);
        SubNode.ImageIndex:=2;
        SubNode.SelectedIndex:=2;
      end;
      for i := 0 to QQMSG.GroupMsgList.Count - 1 do
      begin
        SubNode:=TreeView1.Items.AddChild(GroupMsgNodeRoot,QQMSG.GroupMsgList.Strings[i]);
        SubNode.ImageIndex:=3;
        SubNode.SelectedIndex:=3;
      end;
      for i := 0 to QQMSG.TempSessionMsgList.Count - 1 do
      begin
        SubNode:=TreeView1.Items.AddChild(TempSessionMsgNodeRoot,QQMSG.TempSessionMsgList.Strings[i]);
        SubNode.ImageIndex:=4;
        SubNode.SelectedIndex:=4;
      end;
      for i := 0 to QQMSG.MobileMsgList.Count - 1 do
      begin
        SubNode:=TreeView1.Items.AddChild(MobileMsgNodeRoot,QQMSG.MobileMsgList.Strings[i]);
        SubNode.ImageIndex:=5;
        SubNode.SelectedIndex:=5;
      end;
end;


procedure TMainForm.FormCreate(Sender: TObject);
begin

  C2CMsgNodeRoot:=TreeView1.Items.Add(nil,'聊天消息');
  SysMsgNodeRoot:=TreeView1.Items.Add(nil,'系统消息');
  DiscMsgNodeRoot:=TreeView1.Items.Add(nil,'讨论消息');
  GroupMsgNodeRoot:=TreeView1.Items.Add(nil,'群组消息');
  TempSessionMsgNodeRoot:=TreeView1.Items.Add(nil,'临时会话');
  MobileMsgNodeRoot:=TreeView1.Items.Add(nil,'手机消息');

  C2CMsgNodeRoot.ImageIndex:=0;
  SysMsgNodeRoot.ImageIndex:=1;
  DiscMsgNodeRoot.ImageIndex:=2;
  GroupMsgNodeRoot.ImageIndex:=3;
  TempSessionMsgNodeRoot.ImageIndex:=4;
  MobileMsgNodeRoot.ImageIndex:=5;

  C2CMsgNodeRoot.SelectedIndex:=0;
  SysMsgNodeRoot.SelectedIndex:=1;
  DiscMsgNodeRoot.SelectedIndex:=2;
  GroupMsgNodeRoot.SelectedIndex:=3;
  TempSessionMsgNodeRoot.SelectedIndex:=4;
  MobileMsgNodeRoot.SelectedIndex:=5;



end;


procedure TMainForm.TreeView1Change(Sender: TObject; Node: TTreeNode);
var
  msg:MSGType;
begin
  if Node =  nil then Exit;
  if Node.Level=0  then  Exit;

  if Node.Parent.Text='聊天消息' then
  begin
    msg:=C2CMsg;
  end
  else if Node.Parent.Text='系统消息' then
  begin
    msg:=SysMsg;
  end
  else if Node.Parent.Text='讨论消息' then
  begin
    msg:=DiscMsg;
  end
  else if Node.Parent.Text='群组消息' then
  begin
    msg:=GroupMsg;
  end
  else if Node.Parent.Text='临时会话' then
  begin
    msg:=TempSessionMsg;
  end
  else if Node.Parent.Text='手机消息' then
  begin
    msg:=MobileMsg;
  end;
  Memo1.Text:=(QQMSG.GetMSG(msg,Node.Text));;
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -