using CGWindow API to create a screenshot