Улучшен алгоритм настройки распознавания

This commit is contained in:
cfif 2025-04-24 16:21:57 +03:00
parent cc5daec86f
commit 258da24fa1
8 changed files with 23 additions and 16 deletions

View File

@ -8,6 +8,7 @@
#include <winuser.h> #include <winuser.h>
#include <psapi.h> #include <psapi.h>
#pragma comment(lib, "Winmm.lib") #pragma comment(lib, "Winmm.lib")
//#define DEBUG_PRINTF 1 //#define DEBUG_PRINTF 1
@ -25,6 +26,7 @@ typedef struct {
wchar_t pathWav1[_MAX_PATH]; wchar_t pathWav1[_MAX_PATH];
wchar_t pathWav2[_MAX_PATH]; wchar_t pathWav2[_MAX_PATH];
BOOL error; BOOL error;
int number;
} tCompareStruct; } tCompareStruct;
@ -83,7 +85,7 @@ static BOOL CALLBACK enum_wnd_proc(HWND hwnd, LPARAM lParam) {
if (compareStruct->regim == REGIM_INIT) { if (compareStruct->regim == REGIM_INIT) {
if ((wcscmp(classText, L"Edit") == 0) && (LocalTop == 37)) { if ((wcscmp(classText, L"Edit") == 0) && (compareStruct->number == 4)) {
#ifdef DEBUG_PRINTF #ifdef DEBUG_PRINTF
printf("Edit1 found!\n"); printf("Edit1 found!\n");
@ -96,7 +98,7 @@ static BOOL CALLBACK enum_wnd_proc(HWND hwnd, LPARAM lParam) {
} }
} }
if ((wcscmp(classText, L"Edit") == 0) && (LocalTop == 73)) { if ((wcscmp(classText, L"Edit") == 0) && (compareStruct->number == 5)) {
#ifdef DEBUG_PRINTF #ifdef DEBUG_PRINTF
printf("Edit2 found!\n"); printf("Edit2 found!\n");
#endif #endif
@ -108,7 +110,7 @@ static BOOL CALLBACK enum_wnd_proc(HWND hwnd, LPARAM lParam) {
} }
} }
if ((wcscmp(classText, L"ComboBox") == 0) && (LocalTop == 109)) { if ((wcscmp(classText, L"ComboBox") == 0) && (compareStruct->number == 18)) {
#ifdef DEBUG_PRINTF #ifdef DEBUG_PRINTF
printf("ComboBox1 found!\n"); printf("ComboBox1 found!\n");
#endif #endif
@ -121,7 +123,7 @@ static BOOL CALLBACK enum_wnd_proc(HWND hwnd, LPARAM lParam) {
} }
} }
if ((wcscmp(classText, L"ComboBox") == 0) && (LocalTop == 184)) { if ((wcscmp(classText, L"ComboBox") == 0) && (compareStruct->number == 23)) {
#ifdef DEBUG_PRINTF #ifdef DEBUG_PRINTF
printf("ComboBox2 found!\n"); printf("ComboBox2 found!\n");
#endif #endif
@ -134,7 +136,7 @@ static BOOL CALLBACK enum_wnd_proc(HWND hwnd, LPARAM lParam) {
} }
} }
if ((wcscmp(classText, L"Static") == 0) && (LocalTop == 218)) { if ((wcscmp(classText, L"Static") == 0) && (compareStruct->number == 15)) {
#ifdef DEBUG_PRINTF #ifdef DEBUG_PRINTF
printf("Static found!\n"); printf("Static found!\n");
#endif #endif
@ -153,7 +155,7 @@ static BOOL CALLBACK enum_wnd_proc(HWND hwnd, LPARAM lParam) {
if (compareStruct->regim == REGIM_COMPARE) { if (compareStruct->regim == REGIM_COMPARE) {
if ((wcscmp(classText, L"Button") == 0) && (LocalTop == 221)) { if ((wcscmp(classText, L"Button") == 0) && (compareStruct->number == 17)) {
#ifdef DEBUG_PRINTF #ifdef DEBUG_PRINTF
printf("Button found!\n"); printf("Button found!\n");
#endif #endif
@ -170,7 +172,7 @@ static BOOL CALLBACK enum_wnd_proc(HWND hwnd, LPARAM lParam) {
if (compareStruct->regim == REGIM_RESULT) { if (compareStruct->regim == REGIM_RESULT) {
if ((wcscmp(classText, L"Static") == 0) && (LocalTop == 218)) { if ((wcscmp(classText, L"Static") == 0) && (compareStruct->number == 15)) {
#ifdef DEBUG_PRINTF #ifdef DEBUG_PRINTF
printf("Static found!\n"); printf("Static found!\n");
#endif #endif
@ -193,6 +195,8 @@ static BOOL CALLBACK enum_wnd_proc(HWND hwnd, LPARAM lParam) {
} }
} }
++compareStruct->number;
return TRUE; return TRUE;
} }
@ -260,15 +264,18 @@ static int wmain(int argc, wchar_t* argv[], wchar_t* envp[]) {
GetWindowRect(hwnd, &compareStruct.winRect); GetWindowRect(hwnd, &compareStruct.winRect);
compareStruct.regim = REGIM_INIT; compareStruct.regim = REGIM_INIT;
compareStruct.number = 0;
EnumChildWindows(hwnd, enum_wnd_proc, (LPARAM)(&compareStruct)); EnumChildWindows(hwnd, enum_wnd_proc, (LPARAM)(&compareStruct));
if (compareStruct.error) if (compareStruct.error)
return 3; return 3;
compareStruct.regim = REGIM_COMPARE; compareStruct.regim = REGIM_COMPARE;
compareStruct.number = 0;
EnumChildWindows(hwnd, enum_wnd_proc, (LPARAM)(&compareStruct)); EnumChildWindows(hwnd, enum_wnd_proc, (LPARAM)(&compareStruct));
compareStruct.regim = REGIM_RESULT; compareStruct.regim = REGIM_RESULT;
compareStruct.number = 0;
EnumChildWindows(hwnd, enum_wnd_proc, (LPARAM)(&compareStruct)); EnumChildWindows(hwnd, enum_wnd_proc, (LPARAM)(&compareStruct));
timeKillEvent(timerUpdate); timeKillEvent(timerUpdate);

Binary file not shown.

Binary file not shown.

View File

@ -1,14 +1,14 @@
 Compare.c  Compare.c
C:\VC\Compare\Compare.c(38,36): warning C4047: функция: "LPARAM" отличается по уровням косвенного обращения от "LPCWSTR" C:\VC\Compare\Compare.c(40,36): warning C4047: функция: "LPARAM" отличается по уровням косвенного обращения от "LPCWSTR"
C:\VC\Compare\Compare.c(38,36): warning C4024: SendMessageW: различные типы для формального и фактического параметров 4 C:\VC\Compare\Compare.c(40,36): warning C4024: SendMessageW: различные типы для формального и фактического параметров 4
C:\VC\Compare\Compare.c(39,44): warning C4047: функция: "LPARAM" отличается по уровням косвенного обращения от "wchar_t [260]" C:\VC\Compare\Compare.c(41,44): warning C4047: функция: "LPARAM" отличается по уровням косвенного обращения от "wchar_t [260]"
C:\VC\Compare\Compare.c(39,44): warning C4024: SendMessageW: различные типы для формального и фактического параметров 4 C:\VC\Compare\Compare.c(41,44): warning C4024: SendMessageW: различные типы для формального и фактического параметров 4
C:\VC\Compare\Compare.c(181,46): warning C4047: функция: "LPARAM" отличается по уровням косвенного обращения от "wchar_t [260]" C:\VC\Compare\Compare.c(183,46): warning C4047: функция: "LPARAM" отличается по уровням косвенного обращения от "wchar_t [260]"
C:\VC\Compare\Compare.c(181,46): warning C4024: SendMessageW: различные типы для формального и фактического параметров 4 C:\VC\Compare\Compare.c(183,46): warning C4024: SendMessageW: различные типы для формального и фактического параметров 4
C:\VC\Compare\Compare.c(295,1): warning C4008: wmain: пропуск атрибута "static" C:\VC\Compare\Compare.c(302,1): warning C4008: wmain: пропуск атрибута "static"
Создание кода Создание кода
Создание кода завершено Создание кода завершено
2 of 8 functions (25.0%) were compiled, the rest were copied from previous compilation. 1 of 8 functions (12.5%) were compiled, the rest were copied from previous compilation.
0 functions were new in current compilation 0 functions were new in current compilation
0 functions had inline decision re-evaluated but remain unchanged 1 functions had inline decision re-evaluated but remain unchanged
Compare.vcxproj -> C:\VC\Compare\Release\Compare.exe Compare.vcxproj -> C:\VC\Compare\Release\Compare.exe

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.