Registriert seit: 17. Jan 2007
1.169 Beiträge
Turbo Delphi für Win32
|
Re: Form2 immer vor Form1
5. Mai 2007, 01:25
Moin Moin,
Mein Vorschlag:
Delphi-Quellcode:
private
procedure WMWINDOWPOSCHANGED(var AMsg: TMessage); message WM_WINDOWPOSCHANGED;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses Unit2;
{$R *.dfm}
function SetWinPos(hWnd: THandle; WinPos: PCardinal): Boolean; stdcall;
begin
Result := true;
if IsWindowVisible(hWnd) then
begin
if hWnd = Form1.Handle then
begin
SetWindowPos(Form2.Handle, WinPos^, 0, 0, 0, 0, SWP_NOACTIVATE or SWP_NOMOVE or SWP_NOSIZE);
Result := false;
end;
WinPos^ := hWnd;
end;
end;
procedure TForm1.WMWINDOWPOSCHANGED(var AMsg: TMessage);
var
WinPos : Cardinal;
begin
WinPos := 0;
if Form1.Showing and Form2.Showing then
EnumWindows(@SetWinPos, integer(@WinPos));
//SetWindowPos(Form1.Handle, Form2.Handle, 0, 0, 0, 0, SWP_NOACTIVATE or SWP_NOMOVE or SWP_NOSIZE);
end;
procedure TForm1.FormShow(Sender: TObject);
begin
Form2.Show;
end;
Gruß bitsetter
"Viele Wege führen nach Rom" Wolfgang Mocker (geb. 1954), dt. Satiriker und Aphoristiker
|
|
Zitat
|