灰色按钮克星(附delphi源代码)

社区服务
高级搜索
猴岛论坛电脑百科灰色按钮克星(附delphi源代码)
发帖 回复
正序阅读 最近浏览的帖子最近浏览的版块
0个回复

灰色按钮克星(附delphi源代码)

楼层直达
@深情不及久伴

ZxID:10470282

等级: 贵宾
夏天的爱情。

举报 只看楼主 使用道具 楼主   发表于: 2011-04-20 0
很久很久以前写的了。 翻硬盘翻出来的。
(*^__^*) 嘻嘻
没什么技术含量。
有需要的朋友可以下载下来玩一玩。
也是delphi编写的。

下载链接http://www.brsbox.com/filebox/down/fc/66c5d4cf8083d5f9373d0be662809af8
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls,ShellApi;
type
TForm1 = class(TForm)
    Button1: TButton;
    Timer1: TTimer;
    Edit1: TEdit;
    Button2: TButton;
    Edit2: TEdit;
    Label3: TLabel;
    Label4: TLabel;
    Button3: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Timer1Timer(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button4Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
private
    { Private declarations }
public
    { Public declarations }
end;
var
Form1: TForm1;
IsEnable:Boolean;
function backfunc(AhWnd:hwnd;AlParam:lParam):boolean;stdcall;
implementation
{$R *.dfm}
function backfunc(AhWnd:hwnd;AlParam:lParam):boolean;stdcall;
var
wndcn:array [0..255] of char;
wndcp:array [0..255] of char;
begin
GetClassName(ahwnd,wndcn,255);
GetWindowText(ahwnd,wndcp,255);
if IsEnable then
    EnableWindow(ahwnd,True) //激活
else
    EnableWindow(ahwnd,False);    //变灰
if (pos('停止&',strpas(wndcp)) > 0) or (pos('激活&',strpas(wndcp)) > 0) then
    EnableWindow(ahwnd,True);
    Result := True;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
    if Button1.Tag = 0 then
    begin
      IsEnable := True;
      Button1.Tag := 1;
      Button1.Caption := '停止&';
      Button2.Tag := 0;
      Button2.Caption := '变灰';
      Timer1.Enabled := True;
    end
    else
    begin
      Button1.Tag := 0;
      button1.Caption := '激活&';
      Timer1.Enabled := False;
    end;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
var
h:thandle;
cp:array [0..255] of char;
begin
h := GetForeGroundWindow();
if h <> 0 then
begin
    edit1.Text := IntToStr(h); //返回句柄显示
    GetWindowText(h,cp,255); // 获取标题
    edit2.Text := Strpas(cp);
    EnumChildWindows(h,@backfunc,0);  //枚举窗口所有控件句柄
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
  if Button2.Tag = 0 then
  begin
    IsEnable := False;
    Button2.Tag := 1;
    Button2.Caption := '停止&';
    Button1.Caption := '激活&';
    Button1.Tag := 0;
    Timer1.Enabled := True;
  end else
  begin
    Button2.Tag := 0;
    Button2.Caption := '变灰';
    Timer1.Enabled := False;
    Button1.Enabled := True;
  end;
end;
procedure TForm1.Button4Click(Sender: TObject);
begin
  Timer1Timer(form1);
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
ShowMessage('    灰色按钮激活小工具☆    '+#13#10+#13#10
+'    Coder : Squn    '+#13#10+#13#10+ 'Http://hi.baidu.com/Squnicg')
//ShellExecute(Application.Handle, nil, 'http://hi.baidu.com/squnicg', nil, nil, SW_SHOWNORMAL);
end;
end.


« 返回列表
发帖 回复