好吧,一个简单的例子: 说明: MyShowModal中的FloatWindow就是你的浮动窗<br>type<br> TIntArr = array of HWND;<br> PIntArr = ^TIntArr;<br><br>function DoDisableWindow(Window: HWnd; Data: Longint): Bool; stdcall;<br>var<br> p: PIntArr;<br> l: Integer;<br>begin<br> p := Pointer(data);<br> l := high(p^)+1;<br> if IsWindowVisible(Window) and IsWindowEnabled(Window) then<br> begin<br> setlength(p^, l+1);<br> p^[l] := Window;<br> EnableWindow(Window, False);<br> end;<br> result := True;<br>end;<br><br>function TFormXXX.MyShowModal: Integer;<br>var<br> actwnd: HWND;<br> Lst: TIntArr;<br> i: Integer;<br>begin<br> actwnd := getactivewindow;<br> enumthreadwindows(GetCurrentThreadId, @DoDisableWindow, Integer(@Lst));<br> if handleallocated then<br> enablewindow(handle, true);<br> if FloatWindow.handleallocated then<br> enablewindow(FloatWindow.Handle, True);<br> try<br> result := 0;<br> showwindow(handle, SW_SHOW);<br> setactivewindow(handle);<br> repeat<br> application.HandleMessage;<br> if Application.Terminated then Result := mrCancel;<br> until result<>0;<br> finally<br> for i := 0 to high(lst) do<br> if IsWindow(lst) then<br> EnableWindow(lst, True);<br> setlength(lst, 0);<br> setactivewindow(actwnd);<br> end;<br>end;<br>