home *** CD-ROM | disk | FTP | other *** search
- # Source Generated with Decompyle++
- # File: in.pyc (Python 2.6)
-
- import string
- import sys
- import os
- import win32com.client.dynamic as win32com
- from win32com.client import Dispatch
- import win32api
- import win32gui
- import win32con
- import glob
- import pythoncom
- import time
- from util import CheckClean
- bVisibleEventFired = 0
-
- class ExplorerEvents:
-
- def OnVisible(self, visible):
- global bVisibleEventFired
- bVisibleEventFired = 1
-
-
-
- def TestExplorerEvents():
- global bVisibleEventFired
- iexplore = win32com.client.DispatchWithEvents('InternetExplorer.Application', ExplorerEvents)
- iexplore.Visible = 1
- if not bVisibleEventFired:
- raise RuntimeError, 'The IE event did not appear to fire!'
- bVisibleEventFired
- iexplore.Quit()
- iexplore = None
- bVisibleEventFired = 0
- ie = win32com.client.Dispatch('InternetExplorer.Application')
- ie_events = win32com.client.DispatchWithEvents(ie, ExplorerEvents)
- ie.Visible = 1
- if not bVisibleEventFired:
- raise RuntimeError, 'The IE event did not appear to fire!'
- bVisibleEventFired
- ie.Quit()
- ie = None
- print 'IE Event tests worked.'
-
-
- def TestObjectFromWindow():
- hwnd = win32gui.FindWindow('IEFrame', None)
- for child_class in [
- 'TabWindowClass',
- 'Shell DocObject View',
- 'Internet Explorer_Server']:
- hwnd = win32gui.FindWindowEx(hwnd, 0, child_class, None)
-
- msg = win32gui.RegisterWindowMessage('WM_HTML_GETOBJECT')
- (rc, result) = win32gui.SendMessageTimeout(hwnd, msg, 0, 0, win32con.SMTO_ABORTIFHUNG, 1000)
- ob = pythoncom.ObjectFromLresult(result, pythoncom.IID_IDispatch, 0)
- doc = Dispatch(ob)
- for color in 'red green blue orange white'.split():
- doc.bgColor = color
- time.sleep(0.2)
-
-
-
- def TestExplorer(iexplore):
- if not iexplore.Visible:
- iexplore.Visible = -1
-
- iexplore.Navigate(win32api.GetFullPathName('..\\readme.htm'))
- win32api.Sleep(1000)
- TestObjectFromWindow()
- win32api.Sleep(3000)
-
- try:
- iexplore.Quit()
- except (AttributeError, pythoncom.com_error):
- pass
-
-
-
- def TestAll():
-
- try:
- iexplore = win32com.client.dynamic.Dispatch('InternetExplorer.Application')
- TestExplorer(iexplore)
- win32api.Sleep(1000)
- iexplore = None
- TestExplorerEvents()
- time.sleep(2)
- gencache = gencache
- import win32com.client
- gencache.EnsureModule('{EAB22AC0-30C1-11CF-A7EB-0000C05BAE0B}', 0, 1, 1)
- iexplore = win32com.client.Dispatch('InternetExplorer.Application')
- TestExplorer(iexplore)
- finally:
- iexplore = None
-
-
- if __name__ == '__main__':
- TestAll()
- CheckClean()
-
-