一切与IE有关的窗口死光光<br><br>procedure TForm1.Button1Click(Sender: TObject);<br>var<br> i:integer;<br> hWndStart,hwndLike:HWND;<br> WndCaption:array[0..254] of char;<br> WndClassName:array[0..254] of char;<br> WindowCaption,WindowClass: array [1..12] of string;<br>begin<br> //close 1<br> WindowCaption[1]:='Microsoft';<br> WindowClass[1]:='IE';<br> //close 2<br> WindowCaption[2]:='Microsoft';<br> WindowClass[2]:='#32770';<br> //close 3<br> WindowCaption[3]:='Explorer';<br> WindowClass[3]:='#32770';<br> //close 4<br> WindowCaption[4]:='安装语言';<br> WindowClass[4]:='#32770';<br> //close 5<br> WindowCaption[5]:='文件';<br> WindowClass[5]:='#32770';<br> //close 6<br> WindowCaption[6]:='ActiveX';<br> WindowClass[6]:='#32770';<br> //close 7<br> WindowCaption[7]:='Internet';<br> WindowClass[7]:='#32770';<br> //close 8<br> WindowCaption[8]:='Alert';<br> WindowClass[8]:='#32770';<br> //close 9<br> WindowCaption[9]:='Internet';<br> WindowClass[9]:='Internet';<br> //close 10<br> WindowCaption[10]:='安全设置';<br> WindowClass[10]:='#32770';<br> //close 11<br> WindowCaption[11]:='Script';<br> WindowClass[11]:='SCRDBG';<br> //close 12<br> WindowCaption[12]:='Script';<br> WindowClass[12]:='#32770';<br><br> hWndStart:=GetDesktopWindow;<br> hwndLike:=GetWindow(hWndStart,GW_CHILD);<br> while hwndLike<>0 do<br> begin<br> GetWindowText(hwndLike,@WndCaption,254);<br> GetClassName(hwndLike,@WndClassName,254);<br><br> for i:=1 to 12 do<br> begin<br> if ((pos(WindowCaption,StrPas(WndCaption))<>0) and<br> (pos(WindowClass,StrPas(WndClassName))<>0)) then<br> begin<br> PostMessage(hwndLike,WM_CLOSE,0,0 ); //找到匹配窗口名称与类名或窗口名称匹配<br> break;<br> end;<br> end;<br> hwndLike:=GetWindow(hwndLike,GW_HWNDNEXT);<br> end;<br>end;<br>