# Get window information with ctypes
## pip install ctypes-window-info
```python
This function utilizes the Windows API to retrieve information about windows.
Args:
hwnd (int or None): The handle of the window for which to retrieve the text, defaults to None (all windows).
Returns:
namedtuple: A named tuples with - pid title windowtext hwnd length tid status coords_client dim_client coords_win dim_win class_name path
Note:
This function uses the `GetWindowTextW` function from the `user32` library to retrieve the window text.
It is intended for use on Windows operating systems and relies on the ctypes library to interface with the Windows API.
Examples:
from ctypes_window_info import get_window_infos
get_window_infos()
[[WindowInfo(pid=88, title='Base_PowerMessageWindow', windowtext='', hwnd=197614, length=1, tid=9668, status='invisible', coords_client=(0, 0, 0, 0), dim_client=(0, 0), coords_win=(0, 0, 0, 0), dim_win=(0, 0), class_name='Base_PowerMessageWindow', path='C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe'),
WindowInfo(pid=88, title='Chrome_StatusTrayWindow', windowtext='', hwnd=197592, length=1, tid=9668, status='invisible', coords_client=(0, 0, 0, 0), dim_client=(0, 0), coords_win=(0, 0, 0, 0), dim_win=(0, 0), class_name='Chrome_StatusTrayWindow', path='C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe'),
WindowInfo(pid=88, title='Chrome_SystemMessageWindow', windowtext='', hwnd=197600, length=1, tid=9668, status='invisible', coords_client=(0, 130, 0, 10), dim_client=(130, 10), coords_win=(0, 136, 0, 39), dim_win=(136, 39), class_name='Chrome_SystemMessageWindow', path='C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe'),
WindowInfo(pid=88, title='Chrome_WidgetWin_0', windowtext='', hwnd=197580, length=1, tid=9668, status='invisible', coords_client=(0, 0, 0, 0), dim_client=(0, 0), coords_win=(0, 0, 0, 0), dim_win=(0, 0), class_name='Chrome_WidgetWin_0', path='C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe'),
WindowInfo(pid=88, title='Chrome_WidgetWin_0', windowtext='', hwnd=197606, length=1, tid=9668, status='invisible', coords_client=(0, 1424, 0, 728), dim_client=(1424, 728), coords_win=(182, 1622, 182, 949), dim_win=(1440, 767), class_name='Chrome_WidgetWin_0', path='C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe'),
WindowInfo(pid=88, title='Chrome_WidgetWin_1', windowtext='', hwnd=2492886, length=1, tid=9668, status='invisible', coords_client=(0, 64, 0, 64), dim_client=(64, 64), coords_win=(-1, 63, 1028, 1092), dim_win=(64, 64), class_name='Chrome_WidgetWin_1', path='C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe'),
....
get_window_infos(197614)
[WindowInfo(pid=88, title='Base_PowerMessageWindow', windowtext='', hwnd=197614, length=1, tid=9668, status='invisible', coords_client=(0, 0, 0, 0), dim_client=(0, 0), coords_win=(0, 0, 0, 0), dim_win=(0, 0), class_name='Base_PowerMessageWindow', path='C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe')]
```
Raw data
{
"_id": null,
"home_page": "https://github.com/hansalemaos/ctypes_window_info",
"name": "ctypes-window-info",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "ctypes,windows,hwnd",
"author": "Johannes Fischer",
"author_email": "aulasparticularesdealemaosp@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/09/e3/3d1968a44a63e88e60023bfcb70013e08331351cd341b5ba9a6e1fa945f9/ctypes_window_info-0.15.tar.gz",
"platform": null,
"description": "\r\n# Get window information with ctypes \r\n\r\n\r\n## pip install ctypes-window-info\r\n\r\n\r\n```python\r\n\r\nThis function utilizes the Windows API to retrieve information about windows.\r\n\r\nArgs:\r\n hwnd (int or None): The handle of the window for which to retrieve the text, defaults to None (all windows).\r\n\r\nReturns:\r\n namedtuple: A named tuples with - pid title windowtext hwnd length tid status coords_client dim_client coords_win dim_win class_name path\r\n\r\nNote:\r\n This function uses the `GetWindowTextW` function from the `user32` library to retrieve the window text.\r\n It is intended for use on Windows operating systems and relies on the ctypes library to interface with the Windows API.\r\n\r\nExamples:\r\n from ctypes_window_info import get_window_infos\r\n\r\n get_window_infos()\r\n\r\n [[WindowInfo(pid=88, title='Base_PowerMessageWindow', windowtext='', hwnd=197614, length=1, tid=9668, status='invisible', coords_client=(0, 0, 0, 0), dim_client=(0, 0), coords_win=(0, 0, 0, 0), dim_win=(0, 0), class_name='Base_PowerMessageWindow', path='C:\\\\Program Files (x86)\\\\Google\\\\Chrome\\\\Application\\\\chrome.exe'),\r\n WindowInfo(pid=88, title='Chrome_StatusTrayWindow', windowtext='', hwnd=197592, length=1, tid=9668, status='invisible', coords_client=(0, 0, 0, 0), dim_client=(0, 0), coords_win=(0, 0, 0, 0), dim_win=(0, 0), class_name='Chrome_StatusTrayWindow', path='C:\\\\Program Files (x86)\\\\Google\\\\Chrome\\\\Application\\\\chrome.exe'),\r\n WindowInfo(pid=88, title='Chrome_SystemMessageWindow', windowtext='', hwnd=197600, length=1, tid=9668, status='invisible', coords_client=(0, 130, 0, 10), dim_client=(130, 10), coords_win=(0, 136, 0, 39), dim_win=(136, 39), class_name='Chrome_SystemMessageWindow', path='C:\\\\Program Files (x86)\\\\Google\\\\Chrome\\\\Application\\\\chrome.exe'),\r\n WindowInfo(pid=88, title='Chrome_WidgetWin_0', windowtext='', hwnd=197580, length=1, tid=9668, status='invisible', coords_client=(0, 0, 0, 0), dim_client=(0, 0), coords_win=(0, 0, 0, 0), dim_win=(0, 0), class_name='Chrome_WidgetWin_0', path='C:\\\\Program Files (x86)\\\\Google\\\\Chrome\\\\Application\\\\chrome.exe'),\r\n WindowInfo(pid=88, title='Chrome_WidgetWin_0', windowtext='', hwnd=197606, length=1, tid=9668, status='invisible', coords_client=(0, 1424, 0, 728), dim_client=(1424, 728), coords_win=(182, 1622, 182, 949), dim_win=(1440, 767), class_name='Chrome_WidgetWin_0', path='C:\\\\Program Files (x86)\\\\Google\\\\Chrome\\\\Application\\\\chrome.exe'),\r\n WindowInfo(pid=88, title='Chrome_WidgetWin_1', windowtext='', hwnd=2492886, length=1, tid=9668, status='invisible', coords_client=(0, 64, 0, 64), dim_client=(64, 64), coords_win=(-1, 63, 1028, 1092), dim_win=(64, 64), class_name='Chrome_WidgetWin_1', path='C:\\\\Program Files (x86)\\\\Google\\\\Chrome\\\\Application\\\\chrome.exe'),\r\n ....\r\n\r\n get_window_infos(197614)\r\n [WindowInfo(pid=88, title='Base_PowerMessageWindow', windowtext='', hwnd=197614, length=1, tid=9668, status='invisible', coords_client=(0, 0, 0, 0), dim_client=(0, 0), coords_win=(0, 0, 0, 0), dim_win=(0, 0), class_name='Base_PowerMessageWindow', path='C:\\\\Program Files (x86)\\\\Google\\\\Chrome\\\\Application\\\\chrome.exe')]\r\n\r\n```\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Get window/process information with ctypes, no dependencies",
"version": "0.15",
"project_urls": {
"Homepage": "https://github.com/hansalemaos/ctypes_window_info"
},
"split_keywords": [
"ctypes",
"windows",
"hwnd"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "063e703a792b5b117c08920f45683fac90492be1ef35cf3dbb7b89df1cd926d5",
"md5": "fb473601650331719a898798f73b5511",
"sha256": "7a5b4923c3f05686744815b78bad368a175035dd9015fe63024d903fb0dd98d0"
},
"downloads": -1,
"filename": "ctypes_window_info-0.15-py3-none-any.whl",
"has_sig": false,
"md5_digest": "fb473601650331719a898798f73b5511",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 6106,
"upload_time": "2023-08-20T03:38:45",
"upload_time_iso_8601": "2023-08-20T03:38:45.750168Z",
"url": "https://files.pythonhosted.org/packages/06/3e/703a792b5b117c08920f45683fac90492be1ef35cf3dbb7b89df1cd926d5/ctypes_window_info-0.15-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "09e33d1968a44a63e88e60023bfcb70013e08331351cd341b5ba9a6e1fa945f9",
"md5": "ec00cfcdbc37425f2254e92f71a68478",
"sha256": "75502276e04566e660c70dc7fd1efc0bba7cef09f949d0ffc9dbd31aa305f79b"
},
"downloads": -1,
"filename": "ctypes_window_info-0.15.tar.gz",
"has_sig": false,
"md5_digest": "ec00cfcdbc37425f2254e92f71a68478",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 4350,
"upload_time": "2023-08-20T03:38:47",
"upload_time_iso_8601": "2023-08-20T03:38:47.385631Z",
"url": "https://files.pythonhosted.org/packages/09/e3/3d1968a44a63e88e60023bfcb70013e08331351cd341b5ba9a6e1fa945f9/ctypes_window_info-0.15.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-08-20 03:38:47",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "hansalemaos",
"github_project": "ctypes_window_info",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "ctypes-window-info"
}