import sys
from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parent.parent))

import src.common as common
from src.common.win32_window import find_poe2_window, get_client_rect

hwnd = find_poe2_window()
print(f"HWND: {hex(hwnd) if hwnd else None}")
if hwnd:
    cl, ct, cw, ch = get_client_rect(hwnd)
    print(f"Rect: {cl}, {ct}, {cw}, {ch}")
    img = common.capture_window_bitblt(hwnd, client_only=True)
    if img:
        img.save("captures/current_screen_now.png")
        print(f"Saved captures/current_screen_now.png ({img.size})")
    else:
        print("capture_window_bitblt returned None")
