Delphi Tip/인터넷
현재 떠 있는 모든 IE 찾기 및 닫기
MonoSoft
2021. 12. 7. 12:05
728x90
반응형
현재 떠 있는 모든 IE 찾기 및 닫기
모든 인터넷 익스플로러 핸들을 구해서 WM_CLOSE 메시지를 보낸다.
function CloseAllInternetExplorer: Boolean;
var
WindowHandle: HWND;
ClassName: array[0..260] of char;
begin
WindowHandle := GetWindow(GetDesktopWindow(), GW_CHILD);
while WindowHandle > 0 do
begin
FillChar(ClassName, sizeof(ClassName), #0);
GetClassName(WindowHandle, ClassName, sizeof(ClassName));
if SameText(ClassName, 'IEFrame') then
begin
PostMessage(WindowHandle, WM_CLOSE, 0, 0);
end;
WindowHandle := GetWindow(WindowHandle, GW_HWNDNEXT);
end;
Result := True;
end;
728x90
반응형