unit Unit3;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;
type
TForm3 =
class(TForm)
Button1: TButton;
Edit1: TEdit;
Label1: TLabel;
Edit2: TEdit;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Timer1: TTimer;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form3: TForm3;
implementation
{$R *.dfm}
function TaskBarwidth(
handle:hwnd): integer;
var
hTB: HWND;
// taskbar handle
TBRect: TRect;
// taskbar rectangle
begin
hTB:=
handle;
if hTB = 0
then
Result := 0
else begin
GetWindowRect(hTB, TBRect);
Result := TBRect.Left- TBRect.Right;
end;
end;
function TaskBarHeight(
handle:hwnd): integer;
var
hTB: HWND;
// taskbar handle
TBRect: TRect;
// taskbar rectangle
begin
hTB:=
handle;
if hTB = 0
then
Result := 0
else begin
GetWindowRect(hTB, TBRect);
Result := TBRect.Bottom - TBRect.Top;
end;
end;
procedure TForm3.Button1Click(Sender: TObject);
var
myhandle:hwnd;
handle2:hwnd;
handle3:hwnd;
begin
myhandle:=FindWindow('
shell_traywnd',
nil);
if myhandle>0
then
MoveWindow(myhandle,strtoint(edit1.Text), strtoint(edit2.Text),TaskBarwidth(myhandle), TaskBarheight(myhandle), true)
else
showmessage('
wont work handle is zero');
end;
procedure TForm3.Button2Click(Sender: TObject);
var
myhandle:hwnd;
begin
myhandle:=FindWindowEx(FindWindow('
shell_traywnd',
nil), 0, '
traynotifywnd',
nil) ;
windows.SetParent(myhandle,0);
end;
procedure TForm3.Timer1Timer(Sender: TObject);
var
miska:tmouse;
begin
label3.Caption:=inttostr(miska.CursorPos.X);
label4.Caption:=inttostr(miska.CursorPos.y);
end;
end.