26 lines
1.1 KiB
Python
26 lines
1.1 KiB
Python
# browser/win32_embed.py
|
|
import win32gui
|
|
import win32con
|
|
|
|
def embed_window(child_hwnd, parent_hwnd):
|
|
"""
|
|
지정한 자식 창(child_hwnd)을 부모 창(parent_hwnd)의 자식으로 임베딩합니다.
|
|
제목 표시줄, 테두리, 최소/최대화 버튼 등을 제거하여 깔끔한 임베딩 환경을 제공합니다.
|
|
"""
|
|
# 자식 창의 부모를 설정
|
|
win32gui.SetParent(child_hwnd, parent_hwnd)
|
|
|
|
# 기존 창 스타일을 가져와서 불필요한 스타일 제거
|
|
style = win32gui.GetWindowLong(child_hwnd, win32con.GWL_STYLE)
|
|
style &= ~(win32con.WS_CAPTION | win32con.WS_THICKFRAME |
|
|
win32con.WS_MINIMIZE | win32con.WS_MAXIMIZE | win32con.WS_SYSMENU)
|
|
win32gui.SetWindowLong(child_hwnd, win32con.GWL_STYLE, style)
|
|
return True
|
|
|
|
def move_embedded_window(child_hwnd, x, y, width, height):
|
|
"""
|
|
임베딩된 창(child_hwnd)의 위치와 크기를 지정합니다.
|
|
왼쪽 위 꼭지점은 (x, y)로 고정되고, 지정된 width, height로 리사이즈합니다.
|
|
"""
|
|
win32gui.MoveWindow(child_hwnd, x, y, width, height, True)
|