代码很简单
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,Shellapi, XPMan, ComCtrls, ToolWin;
type
TForm1 = class(TForm)
ListBox1: TListBox;
Button1: TButton;
Button2: TButton;
Edit1: TEdit;
Label2: TLabel;
Button3: TButton;
Label3: TLabel;
Edit2: TEdit;
Button4: TButton;
XPManifest1: TXPManifest;
StatusBar1: TStatusBar;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
Function EnumWindowsProc(h:hwnd;lp:integer):boolean;stdcall;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
EnumWindows(@EnumWindowsProc,0);
end;
Function EnumWindowsProc(h:hwnd;lp:integer):boolean;stdcall;
var
bstr:array[0..255] of char;
begin
if GetWindowText(h,bstr,windows.MAX_PATH) >0 then
begin
Form1.ListBox1.Items.Add(bstr);
end;
result:=true;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
form1.ListBox1.Clear;
end;
procedure TForm1.Button3Click(Sender: TObject);
var
fh:hwnd;
begin
fh:=FindWindow(nil,pointer(edit1.text));
if fh=0 then exit;
SetWindowText(fh,pointer(edit2.text));
end;
procedure TForm1.Button4Click(Sender: TObject);
begin
ShellExecute(handle,'open','http://bbs.52pojie.cn',nil,nil,SW_SHOW);
end;
end.
test.rar
(175.29 KB, 下载次数: 399)
|