-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathMovingWindows.pas
More file actions
34 lines (34 loc) · 805 Bytes
/
MovingWindows.pas
File metadata and controls
34 lines (34 loc) · 805 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
unit WinMoveU;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Unit2;
type
TForm1 = class(TForm)
procedure FormShow(Sender: TObject);
private
{ Private declarations }
{we must override the WM_MOVE message}
procedure WMMove(var Msg: TWMMove); message WM_MOVE;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.FormShow(Sender: TObject);
begin
{show the toolbar window}
Form2.Show;
end;
{this is fired every time the main window is moved}
procedure TForm1.WMMove(var Msg: TWMMove);
begin
{if the toolbar window exists...}
if Form2<>NIL then
{...move the toolbar window alongside the main window.}
MoveWindow(Form2.Handle, Form1.Left+Form1.Width+5, Form1.Top, Form2.Width,
Form2.Height, TRUE);
end;
end