试一下以下方法:
function TForm1.WindowIsOnTop(hWin:THandle):Boolean;
var
hTopWin:THandle;
begin
hTopWin:=GetActiveWindow;
Result:=hTopWin=hWin;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
if WindowIsOnTop(Form2.Handle) then
ShowMessage('Top')
else
ShowMessage('Untop');
end;