-
Notifications
You must be signed in to change notification settings - Fork 6
/
IllegalWindowSpec.cpp
59 lines (48 loc) · 1.41 KB
/
IllegalWindowSpec.cpp
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
#include <windows.h>
#include <string>
#include "IllegalWindowSpec.h"
#include "wildcard.h"
void GetWindowFileName(HWND window, char* file, int size);
IllegalWindowSpec::IllegalWindowSpec() {
};
BOOL IllegalWindowSpec::match(HWND window)
{
//## begin AutoFunction::Match%-160473114.body preserve=yes
if ( !::IsWindow( window ) ) {
return FALSE ;
} else {
BOOL match = TRUE ;
BOOL checkedSomething = FALSE ;
if (m_title.length()) {
checkedSomething = TRUE ;
char title[256] ;
::GetWindowText(window, title, 256) ;
string Title( title ) ;
if (!(wildcard(m_title, Title, (m_caseSensitive ? FNM_BASHSTYLE | FNM_NOESCAPE : FNM_BASHSTYLE | FNM_CASEFOLD | FNM_NOESCAPE) ))) {
match = FALSE ;
}
}
if (m_winClass.length()) {
checkedSomething = TRUE ;
char winclass[256] ;
::GetClassName(window, winclass, 256 ) ;
string Class(winclass) ;
if (!(wildcard(m_winClass, Class, (m_caseSensitive ? FNM_BASHSTYLE | FNM_NOESCAPE : FNM_BASHSTYLE | FNM_CASEFOLD | FNM_NOESCAPE) ))) {
match = FALSE ;
}
}
if (m_filename.length()) {
checkedSomething = TRUE ;
char file[256] ;
GetWindowFileName(window, file, 256);
string File(file) ;
if (!(wildcard(m_filename, File, (m_caseSensitive ? FNM_BASHSTYLE | FNM_NOESCAPE : FNM_BASHSTYLE | FNM_CASEFOLD | FNM_NOESCAPE) ))) {
match = FALSE ;
}
}
if ( !checkedSomething ) {
match = FALSE ;
}
return match ;
}
}