Exemplo n.º 1
0
    def get_window_info():
        all_window_handles = findwindows.enum_windows()
        for window_handle in all_window_handles:
            if handleprops.isvisible(window_handle):
                pos_x = handleprops.rectangle(window_handle).left
                pos_y = handleprops.rectangle(window_handle).top
                size_x = handleprops.rectangle(window_handle).width()
                size_y = handleprops.rectangle(window_handle).height()
                title_name = handleprops.text(window_handle)
                class_name = handleprops.classname(window_handle)
                pid = handleprops.processid(window_handle)
                date_time = datetime.datetime.now()

                # Note: Minimized windows have negative pos_x and pos_y values (and smaller sizes).

                window_info = [
                    pos_x, pos_y, size_x, size_y, title_name, class_name, pid,
                    date_time
                ]
                window_db_id = database.create_window_record(window_info)
                logger.info(
                    'OpenWindow record created in database (db_id %i).' %
                    window_db_id)
 def test_isvisible(self):
     """Make sure the isvisible method returns correct result"""
     self.assertEquals(True, isvisible(self.dlghandle))
     self.assertEquals(True, isvisible(self.edit_handle))
Exemplo n.º 3
0
 def test_isvisible(self):
     "Make sure the isvisible method returns correct result"
     self.assertEquals(True, isvisible(self.dlghandle))
     self.assertEquals(True, isvisible(self.edit_handle))
Exemplo n.º 4
0
 def test_isvisible(self):
     """Make sure the isvisible method returns correct result"""
     self.assertEqual(True, isvisible(self.dlghandle))
     self.assertEqual(True, isvisible(self.edit_handle))
     self.assertEqual(False, isvisible(sys.maxsize))
     self.assertEqual(False, isvisible(None))