unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
Memo1: TMemo;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
procedure wmWindowposchanging( var msg: TWMWindowposchanging );
message wm_windowposchanging;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.wmWindowposchanging(var msg: TWMWindowposchanging);
function FlagsToText( someFlags: Integer ): String;
type
Tflag = Record flag: Integer; name: String End;
const
MAXFLAG = 13;
flags: Array [1..MAXFLAG] of Tflag =
(
( flag: SWP_NOSIZE; name: 'SWP_NOSIZE' ),
( flag: SWP_NOMOVE; name: 'SWP_NOMOVE' ),
( flag: SWP_NOZORDER; name: 'SWP_NOZORDER' ),
( flag: SWP_NOREDRAW; name: 'SWP_NOREDRAW' ),
( flag: SWP_NOACTIVATE; name: 'SWP_NOACTIVATE' ),
( flag: SWP_FRAMECHANGED; name: 'SWP_FRAMECHANGED' ),
( flag: SWP_SHOWWINDOW; name: 'SWP_SHOWWINDOW' ),
( flag: SWP_HIDEWINDOW; name: 'SWP_HIDEWINDOW' ),
( flag: SWP_NOCOPYBITS; name: 'SWP_NOCOPYBITS' ),
( flag: SWP_NOOWNERZORDER; name: 'SWP_NOOWNERZORDER' ),
( flag: SWP_NOSENDCHANGING; name: 'SWP_NOSENDCHANGING' ),
( flag: SWP_DEFERERASE; name: 'SWP_DEFERERASE' ),
( flag: SWP_ASYNCWINDOWPOS; name: 'SWP_ASYNCWINDOWPOS' )
);
var
i: Integer;
Begin
Result := IntToHex( someFlags, 4 )+': [';
For i := Low(flags) To High(flags) Do Begin
If (flags[i].flag and someFlags) <> 0 Then Begin
Result := Result + flags[i].name + ', ';
End; { If }
End; { For }
If Result[ length(result)] <> '[' Then
Delete( Result, length(result)-1, 2 );
Result := result + ']';
End;
begin
memo1.lines.Clear;
with msg.WindowPos^ do
memo1.lines.add(
format('Time: %d, hwnd %x, hwndInsertAfter %x'#13#10+
'x: %d, y: %d, cx: %d, cy: %d'#13#10+
'flags: %s',
[GetTickcount, hwnd, hwndinsertafter, x, y, cx, cy,
FlagsToText( flags )] ));
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
ShowWindow( handle, SW_SHOWMINIMIZED );
end;
end. |
|