我在程序出一开始就打开主窗口,另外再ShowModal一个登录窗口,假如这时有用WEB控件弹出一个广告页面,这个广告是背投的,这时这个主窗口会自动(不是人为)失去焦点,而这个登录窗口被隐藏在后面,然后鼠标点回来会什么都点不了,(因为看不到登录窗口),而用TAB+SHIT置到这个程序时,才会出现登录窗口。
不知道怎么解决这种,有时候会出现这种showmodal的窗口跑到背后去,然后主窗口又点不了的状况
不知道怎么解决这种,有时候会出现这种showmodal的窗口跑到背后去,然后主窗口又点不了的状况
解决方案 »
- 怎么样防止jpg异常弹出来[问题点数:100分]
- delphi+access做的系统,拿到没装access的机器上也能运行吗?
- 这是怎么实现的?
- 求[]号的用法(没分了,累足了再加)
- 求SQL语句:有难度
- 菜鸟问题,请各位大侠相救,我作了一个简单的DCOM组件,可用CreateRemoteComObject建立时,总是报告"没有注册类别",如何解决?
- string如何转化为TFieldType?
- 各位高手。谁能帮小弟解决一个简单的问题~!感激不尽~!!!
- 请告诉我下面这句话怎样操作,谢谢!
- DELPHI下针式打印机不能连续进纸打印问题,急盼!~!!!!!!!!!!!!!!
- delphi如何修改局域网代理和宽带拨号代理 up有分
- 谁有DELPHI 5 开发人员指南啊 卖小弟一本,拒绝复印版
另外,如果只是弹出去,点底下任务栏的程序回来能到主窗口+登录窗口显示的也行的。关键是点回来,登录窗口不会显示
function TApplication.MessageBox(const Text, Caption: PChar; Flags: Longint): Integer;
var
ActiveWindow: HWnd;
WindowList: Pointer;
MBMonitor, AppMonitor: HMonitor;
MonInfo: TMonitorInfo;
Rect: TRect;
FocusState: TFocusState;
begin
ActiveWindow := GetActiveWindow;
MBMonitor := MonitorFromWindow(ActiveWindow, MONITOR_DEFAULTTONEAREST);
AppMonitor := MonitorFromWindow(Handle, MONITOR_DEFAULTTONEAREST);
if MBMonitor <> AppMonitor then
begin
MonInfo.cbSize := Sizeof(TMonitorInfo);
GetMonitorInfo(MBMonitor, @MonInfo);
GetWindowRect(Handle, Rect);
SetWindowPos(Handle, 0,
MonInfo.rcMonitor.Left + ((MonInfo.rcMonitor.Right - MonInfo.rcMonitor.Left) div 2),
MonInfo.rcMonitor.Top + ((MonInfo.rcMonitor.Bottom - MonInfo.rcMonitor.Top) div 2),
0, 0, SWP_NOACTIVATE or SWP_NOREDRAW or SWP_NOSIZE or SWP_NOZORDER);
end;
WindowList := DisableTaskWindows(0);
FocusState := SaveFocusState;
if UseRightToLeftReading then Flags := Flags or MB_RTLREADING;
try
Result := Windows.MessageBox(Handle, Text, Caption, Flags);
finally
if MBMonitor <> AppMonitor then
SetWindowPos(Handle, 0,
Rect.Left + ((Rect.Right - Rect.Left) div 2),
Rect.Top + ((Rect.Bottom - Rect.Top) div 2),
0, 0, SWP_NOACTIVATE or SWP_NOREDRAW or SWP_NOSIZE or SWP_NOZORDER);
EnableTaskWindows(WindowList);
SetActiveWindow(ActiveWindow);
RestoreFocusState(FocusState);
end;
end;