unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
Button3: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject); //вывод сообщения "HI!"
begin
ShowMessage('Hi!');
end;
procedure TForm1.Button2Click(Sender: TObject); //перемещение Button 1 на рабочий стол
var h: HWND;
begin
h:= GetDesktopWindow();
windows.SetParent(button1.Handle, h)
end;
procedure TForm1.Button3Click(Sender: TObject); //усыпание кнопками
var h: HWND;
b: Tbutton;
i: integer;
begin
h:= GetDesktopWindow();
for i:=1 to {кол-во кнопок} 100 do begin
b:= TButton.Create(Owner);
b.Parent:= form1;
Windows.SetParent(b.Handle, h);
b.left:= random(Screen.Width);
b.Top:= random(Screen.Height);
b.Caption:= 'Button' + IntToStr(i);
end;
end;
end.
Копирайт © 2007, Lanselot. Все права защищены.