[Delphi (Object Pascal)] Delphi关闭所有弹出窗口的代码 →→→→→进入此内容的聊天室

来自 , 2019-03-26, 写在 Delphi (Object Pascal), 查看 115 次.
URL http://www.code666.cn/view/0c122783
  1. procedure CloseAllPopupWindows(const AHandle: THandle);
  2. var
  3.   h, h2: THandle;
  4.   pid, pid2: DWord;
  5.   r: TRect;
  6. begin
  7.   GetWindowThreadProcessId(AHandle, @pid);
  8.   h := GetWindow(AHandle, GW_HWNDFIRST);
  9.   while h <> 0 do begin
  10.     h2 := h;
  11.     h := GetWindow(h, GW_HWNDNEXT);
  12.     if (h2 <> AHandle) and IsWindowVisible(h2) and GetWindowRect(h2, r) and (r.Right > r.Left) then begin
  13.       GetWindowThreadProcessId(h2, @pid2);
  14.       if pid = pid2 then begin
  15.         SendMessage(h2, WM_CLOSE, 0, 0);
  16.       end;
  17.     end;
  18.   end;
  19.   SetForegroundWindow(AHandle);
  20. end;
  21.  
  22.  
  23. //delphi/6735

回复 "Delphi关闭所有弹出窗口的代码 "

这儿你可以回复上面这条便签

captcha