Humm sorry guys let me be a bit more clear, I tried to run the this code, but it doesn't close the window Thanks -george
import win32gui import win32con import string def windowEnumerationHandler(hwnd, resultList): if string.find(win32gui.GetWindowText(hwnd),"Microsoft Internet Explorer") != -1: resultList.append(hwnd) else: None if __name__ == '__main__': topWindows = [] win32gui.EnumWindows(windowEnumerationHandler, topWindows) for i in topWindows: print 'Trying to close IE window = ' + win32gui.GetWindowText(i) win32gui.SendMessage(i,win32con.WM_CLOSE,0,0) -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of George Flaherty Sent: Thursday, January 05, 2006 4:15 PM Cc: python-win32@python.org Subject: Re: [python-win32] Query and remove all IEBrowsers Okay I figured out all the ides of all the IE Browser windows (thanks), but now how do I send the "WM_CLOSE" to each id? thanks george -----Original Message----- From: Niki Spahiev [mailto:[EMAIL PROTECTED] Sent: Thursday, January 05, 2006 12:46 PM To: George Flaherty Cc: python-win32@python.org Subject: Re: [python-win32] Query and remove all IEBrowsers George Flaherty wrote: > Is it possible with python/win32 to "query and remove" all running internet > explorers (ie browsers)? > > I have an automation package that requires no existing internet explorers to > be running. So I would like to call a python/win32 script to close out any ie > browser windows, then run the automation tools. You can enumerate top level windows and send WM_CLOSE to IE ones. Niki Spahiev _______________________________________________ Python-win32 mailing list Python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32 _______________________________________________ Python-win32 mailing list Python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32