2
2
from typing import Union
3
3
4
4
from je_auto_control .windows .core .utils .win32_ctype_input import user32
5
- from je_auto_control .windows .keyboard .win32_ctype_keyboard_control import press_key
6
5
7
6
EnumWindows = user32 .EnumWindows
8
7
EnumWindowsProc = WINFUNCTYPE (c_bool , POINTER (c_int ), POINTER (c_int ))
12
11
FindWindowW = user32 .FindWindowW
13
12
PostMessageW = user32 .PostMessageW
14
13
SendMessageW = user32 .SendMessageW
14
+ CloseWindow = user32 .CloseWindow
15
+ DestroyWindow = user32 .DestroyWindow
16
+
17
+ messages = {
18
+ "WM_CLOSE" : 0x0010
19
+ }
15
20
16
21
17
22
def get_all_window_hwnd ():
@@ -33,15 +38,23 @@ def get_one_window_hwnd(window_class: Union[None, str], window_name: Union[None,
33
38
return FindWindowW (window_class , window_name )
34
39
35
40
36
- def send_key_to_window (window_name : str , action_message : int ,
37
- key_code_1 : int , key_code_2 : int ):
41
+ def send_message_to_window (window_name : str , action_message : int ,
42
+ key_code_1 : int , key_code_2 : int ):
38
43
_hwnd = FindWindowW (window_name )
39
44
post_status = SendMessageW (_hwnd , action_message , key_code_1 , key_code_2 )
40
45
return _hwnd , post_status
41
46
42
47
43
- def post_key_to_window (window_name : str , action_message : int ,
44
- key_code_1 : int , key_code_2 : int ):
48
+ def post_message_to_window (window_name : str , action_message : int ,
49
+ key_code_1 : int , key_code_2 : int ):
45
50
_hwnd = FindWindowW (window_name )
46
51
post_status = PostMessageW (_hwnd , action_message , key_code_1 , key_code_2 )
47
52
return _hwnd , post_status
53
+
54
+
55
+ def close_window (hwnd ) -> bool :
56
+ return CloseWindow (hwnd )
57
+
58
+
59
+ def destroy_window (hwnd ) -> bool :
60
+ return DestroyWindow (hwnd )
0 commit comments