프로그래밍언어/Python

Python)계산기 SendMessage예제 Ctypes

부산딸랑이 2014. 11. 6. 12:21

import ctypes
SendMessage = ctypes.windll.user32.SendMessageW
FindWindow = ctypes.windll.user32.FindWindowW
FindWindowEx = ctypes.windll.user32.FindWindowExA

hNote = FindWindow(None, '계산기')
print(hex(hNote))
hNoteEdit = FindWindowEx(hNote, 0, b'CalcFrame', None)
print(hex(hNoteEdit))
hNoteEdit = FindWindowEx(hNoteEdit, 0, b'#32770', None)
print(hex(hNoteEdit))
hNoteEdit = FindWindowEx(hNoteEdit, 0, b'Static', '0')
print(hex(hNoteEdit))
res = SendMessage(hNoteEdit, 0xC, 0, "계산기")
print(res)