-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathWindow.c
100 lines (84 loc) · 2 KB
/
Window.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
/*
* CLCL
*
* Window.c
*
* Copyright (C) 1996-2019 by Ohno Tomoaki. All rights reserved.
* https://www.nakka.com/
*/
/* Include Files */
#define _INC_OLE
#include <windows.h>
#undef _INC_OLE
#include "General.h"
#include "String.h"
#include "Ini.h"
#include "Window.h"
/* Define */
/* Global Variables */
// オプション
extern OPTION_INFO option;
/* ocal Function Prototypes */
/*
* window_to_index - ウィンドウ情報のインデックスを取得
*/
static int window_to_index(const HWND hWnd)
{
TCHAR title[BUF_SIZE];
TCHAR class_name[BUF_SIZE];
int i;
if (option.window_filter_cnt <= 0) {
return -1;
}
*title = TEXT('\0');
GetWindowText(hWnd, title, BUF_SIZE - 1);
*class_name = TEXT('\0');
GetClassName(hWnd, class_name, BUF_SIZE - 1);
for (i = 0; i < option.window_filter_cnt; i++) {
// ウィンドウのタイトルとクラス名のチェック
if (((option.window_filter_info + i)->title == NULL ||
*(option.window_filter_info + i)->title == TEXT('\0') ||
str_match((option.window_filter_info + i)->title, title) == TRUE) &&
((option.window_filter_info + i)->class_name == NULL ||
*(option.window_filter_info + i)->class_name == TEXT('\0') ||
str_match((option.window_filter_info + i)->class_name, class_name) == TRUE)) {
return i;
}
}
return -1;
}
/*
* window_ignore_check - 除外ウィンドウのチェック
*/
BOOL window_ignore_check(const HWND hWnd)
{
int i;
if ((i = window_to_index(hWnd)) == -1) {
return TRUE;
}
return (((option.window_filter_info + i)->ignore == 0) ? TRUE : FALSE);
}
/*
* window_focus_check - フォーカス設定のチェック
*/
BOOL window_focus_check(const HWND hWnd)
{
int i;
if ((i = window_to_index(hWnd)) == -1) {
return TRUE;
}
return (((option.window_filter_info + i)->focus == 0) ? FALSE : TRUE);
}
/*
* window_paste_check - 貼り付けのチェック
*/
BOOL window_paste_check(const HWND hWnd)
{
int i;
if ((i = window_to_index(hWnd)) == -1) {
return FALSE;
}
return (((option.window_filter_info + i)->paste == 0) ? FALSE : TRUE);
}
/* End of source */