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

This commit is contained in:
cfif 2025-04-25 09:57:39 +03:00
parent 258da24fa1
commit fa93e2988f
9 changed files with 15 additions and 23 deletions

View File

@ -1,12 +1,11 @@
// Compare.cpp : Этот файл содержит функцию "main". Здесь начинается и заканчивается выполнение программы.
// Compare.c : Этот файл содержит функцию "main". Здесь начинается и заканчивается выполнение программы.
//
#include <windows.h>
#include <windowsx.h>
#include <stdio.h>
#include <winuser.h>
#include <psapi.h>
#pragma comment(lib, "Winmm.lib")
@ -37,8 +36,8 @@ static BOOL setTextHwnd(HWND hwnd, LPCWSTR text1, int timeout) {
for (int i = 0; i < timeout; ++i) {
SendMessage(hwnd, WM_SETTEXT, 0, text1);
SendMessage(hwnd, WM_GETTEXT, _MAX_PATH, text2);
SendMessage(hwnd, WM_SETTEXT, 0, (LPARAM)text1);
SendMessage(hwnd, WM_GETTEXT, _MAX_PATH, (LPARAM)text2);
if (wcscmp(text1, text2) == 0) {
return FALSE;
@ -180,7 +179,7 @@ static BOOL CALLBACK enum_wnd_proc(HWND hwnd, LPARAM lParam) {
wcscpy_s(text, _MAX_PATH, L" ");
for (int i = 0; i < 50; ++i) {
SendMessage(hwnd, WM_GETTEXT, _MAX_PATH, text);
SendMessage(hwnd, WM_GETTEXT, _MAX_PATH, (LPARAM)text);
if (wcscmp(text, L" -200.0%") == 0) {
Sleep(100);
@ -210,10 +209,9 @@ static void CALLBACK TimerUpdate(UINT wTimerID, UINT msg, DWORD dwUser, DWORD dw
PostMessage(hwnd, WM_CLOSE, 0, 0);
}
return;
}
static int wmain(int argc, wchar_t* argv[], wchar_t* envp[]) {
int wmain(int argc, wchar_t* argv[], wchar_t* envp[]) {
tCompareStruct compareStruct;
@ -253,14 +251,16 @@ static int wmain(int argc, wchar_t* argv[], wchar_t* envp[]) {
if (hwnd != NULL) {
DWORD hprocessId = 0;
GetWindowThreadProcessId(hwnd, &hprocessId);
//DWORD hprocessId = 0;
//GetWindowThreadProcessId(hwnd, &hprocessId);
HANDLE processHandle = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, hprocessId);
//HANDLE processHandle = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, hprocessId);
GetModuleFileNameExW(processHandle, NULL, compareStruct.captionWindow, _MAX_PATH);
//GetModuleFileNameExW(processHandle, NULL, compareStruct.captionWindow, _MAX_PATH);
timerUpdate = timeSetEvent(50, 0, (LPTIMECALLBACK)TimerUpdate, (DWORD_PTR)&compareStruct, TIME_PERIODIC);
GetFullPathNameW(L"Sound-Similar-Free.exe", _MAX_PATH, compareStruct.captionWindow, NULL);
timerUpdate = timeSetEvent(10, 0, (LPTIMECALLBACK)TimerUpdate, (DWORD_PTR)&compareStruct, TIME_PERIODIC);
GetWindowRect(hwnd, &compareStruct.winRect);
compareStruct.regim = REGIM_INIT;

Binary file not shown.

Binary file not shown.

View File

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

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.