Get window information with ctypes
pip install ctypes-window-info
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')]
Metadata
Release files for ctypes-window-info 0.15
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ctypes_window_info-0.15.tar.gz | 4.3 kB | Without provenance | Details for ctypes_window_info-0.15.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ctypes_window_info-0.15-py3-none-any.whl | Python 3 | none | any | Details for ctypes_window_info-0.15-py3-none-any.whl |
Total release size: 10.5 kB
Release files / ctypes_window_info-0.15.tar.gz
| Download URL | ctypes_window_info-0.15.tar.gz |
|---|---|
| Size | 4.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
75502276e04566e660c70dc7fd1efc0bba7cef09f949d0ffc9dbd31aa305f79b
|
|
BLAKE2b-256 checksum How to use checksums |
09e33d1968a44a63e88e60023bfcb70013e08331351cd341b5ba9a6e1fa945f9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.10
|
Release files / ctypes_window_info-0.15-py3-none-any.whl
| Download URL | ctypes_window_info-0.15-py3-none-any.whl |
|---|---|
| Size | 6.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7a5b4923c3f05686744815b78bad368a175035dd9015fe63024d903fb0dd98d0
|
|
BLAKE2b-256 checksum How to use checksums |
063e703a792b5b117c08920f45683fac90492be1ef35cf3dbb7b89df1cd926d5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.10
|
Security for ctypes-window-info 0.15
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.