docs: restructure markdown docs and publish the bridge
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
"""List all windows (visible or not) belonging to Weixin processes."""
|
||||
import win32gui, win32process, psutil, json, sys
|
||||
|
||||
target_pids = {}
|
||||
for p in psutil.process_iter(['pid', 'name']):
|
||||
try:
|
||||
if p.info['name'] and p.info['name'].lower() in ('weixin.exe', 'wechat.exe'):
|
||||
target_pids[p.info['pid']] = p.info['name']
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
rows = []
|
||||
def cb(hwnd, _):
|
||||
_, pid = win32process.GetWindowThreadProcessId(hwnd)
|
||||
if pid in target_pids:
|
||||
rows.append(dict(hwnd=hwnd, pid=pid, cls=win32gui.GetClassName(hwnd),
|
||||
title=win32gui.GetWindowText(hwnd),
|
||||
visible=bool(win32gui.IsWindowVisible(hwnd)),
|
||||
iconic=bool(win32gui.IsIconic(hwnd)),
|
||||
rect=win32gui.GetWindowRect(hwnd)))
|
||||
return True
|
||||
|
||||
win32gui.EnumWindows(cb, None)
|
||||
print("pids:", target_pids)
|
||||
for r in rows:
|
||||
print(json.dumps(r, ensure_ascii=False))
|
||||
Reference in New Issue
Block a user