This commit is contained in:
cfif 2025-04-17 10:09:03 +03:00
commit ceec022b4f
32 changed files with 432 additions and 0 deletions

216
Compare.c Normal file
View File

@ -0,0 +1,216 @@
// Compare.cpp : Этот файл содержит функцию "main". Здесь начинается и заканчивается выполнение программы.
//
#include <windows.h>
#include <windowsx.h>
#include <stdio.h>
#include <winuser.h>
#include <psapi.h>
#pragma comment(lib, "Winmm.lib")
//#define DEBUG_PRINTF 1
typedef enum {
REGIM_INIT = 0,
REGIM_COMPARE = 1,
REGIM_RESULT = 2
} eRegim;
typedef struct {
RECT winRect;
eRegim regim;
wchar_t captionWindow[_MAX_PATH];
wchar_t pathWav1[_MAX_PATH];
wchar_t pathWav2[_MAX_PATH];
} tCompareStruct;
static BOOL CALLBACK enum_wnd_proc(HWND hwnd, LPARAM lParam) {
tCompareStruct* compareStruct = (tCompareStruct*)lParam;
wchar_t classText[_MAX_PATH];
RECT Rect;
GetClassName(hwnd, classText, _MAX_PATH);
GetWindowRect(hwnd, &Rect);
LONG LocalTop = Rect.top - compareStruct->winRect.top;
#ifdef DEBUG_PRINTF
printf("HWND = %u, CLASS = %ls, GlobalTop = %d LocallTop = %d\n", hwnd, classText, Rect.top, LocalTop);
#endif
if (compareStruct->regim == REGIM_INIT) {
if ((wcscmp(classText, L"Edit") == 0) && (LocalTop == 37)) {
#ifdef DEBUG_PRINTF
printf("Edit1 found!\n");
#endif
SendMessage(hwnd, WM_SETTEXT, 0, (LPARAM)compareStruct->pathWav1);
}
if ((wcscmp(classText, L"Edit") == 0) && (LocalTop == 73)) {
#ifdef DEBUG_PRINTF
printf("Edit2 found!\n");
#endif
SendMessage(hwnd, WM_SETTEXT, 0, (LPARAM)compareStruct->pathWav2);
}
if ((wcscmp(classText, L"ComboBox") == 0) && (LocalTop == 109)) {
#ifdef DEBUG_PRINTF
printf("ComboBox1 found!\n");
#endif
ComboBox_SetCurSel(hwnd, 1);
}
if ((wcscmp(classText, L"ComboBox") == 0) && (LocalTop == 184)) {
#ifdef DEBUG_PRINTF
printf("ComboBox2 found!\n");
#endif
ComboBox_SetCurSel(hwnd, 1);
}
if ((wcscmp(classText, L"Static") == 0) && (LocalTop == 218)) {
#ifdef DEBUG_PRINTF
printf("Static found!\n");
#endif
char text[] = "-200.0%";
SetWindowTextA(hwnd, (LPSTR)text);
}
}
if (compareStruct->regim == REGIM_COMPARE) {
if ((wcscmp(classText, L"Button") == 0) && (LocalTop == 221)) {
#ifdef DEBUG_PRINTF
printf("Button found!\n");
#endif
LONG lParam = MAKELONG(243, 28);
SendMessage(hwnd, WM_LBUTTONDOWN, MK_LBUTTON, lParam);
SendMessage(hwnd, WM_LBUTTONDOWN, MK_LBUTTON, lParam);
SendMessage(hwnd, WM_LBUTTONDOWN, MK_LBUTTON, lParam);
Sleep(100);
SendMessage(hwnd, WM_LBUTTONUP, MK_LBUTTON, lParam);
SendMessage(hwnd, WM_LBUTTONUP, MK_LBUTTON, lParam);
SendMessage(hwnd, WM_LBUTTONUP, MK_LBUTTON, lParam);
}
}
if (compareStruct->regim == REGIM_RESULT) {
if ((wcscmp(classText, L"Static") == 0) && (LocalTop == 218)) {
#ifdef DEBUG_PRINTF
printf("Static found!\n");
#endif
char text[_MAX_PATH];
GetWindowTextA(hwnd, (LPSTR)text, _MAX_PATH);
printf("Similarity Score:%s\n", text);
}
}
return TRUE;
}
static void CALLBACK TimerUpdate(UINT wTimerID, UINT msg, DWORD dwUser, DWORD dwl, DWORD dw2) {
tCompareStruct* compareStruct = (tCompareStruct*)dwUser;
HWND hwnd = FindWindowW(NULL, compareStruct->captionWindow);
if (hwnd != NULL) {
PostMessage(hwnd, WM_CLOSE, 0, 0);
}
return;
}
int wmain(int argc, wchar_t* argv[], wchar_t* envp[]) {
tCompareStruct compareStruct;
wchar_t captionWindow[_MAX_PATH];
wcscpy_s(captionWindow, _MAX_PATH, L"Sound-Similar 1.1 (Free Version) by Virtins Technology");
UINT timerUpdate = 0;
if (argc != 3) {
printf("Error: Invalid parameters\n");
return 1;
}
wcscpy_s(compareStruct.pathWav1, _MAX_PATH, argv[1]);
wcscpy_s(compareStruct.pathWav2, _MAX_PATH, argv[2]);
HWND hwnd = FindWindowW(NULL, captionWindow);
if (hwnd == NULL) {
WinExec("Sound-Similar-Free.exe", SW_SHOWNORMAL);
for (int i = 0; i < 500; ++i) {
hwnd = FindWindowW(NULL, captionWindow);
if (IsWindowVisible(hwnd) == TRUE) {
ShowWindow(hwnd, SW_HIDE);
break;
}
Sleep(1);
}
}
if (hwnd != NULL) {
DWORD hprocessId = 0;
GetWindowThreadProcessId(hwnd, &hprocessId);
HANDLE processHandle = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, hprocessId);
GetModuleFileNameExW(processHandle, NULL, compareStruct.captionWindow, _MAX_PATH);
timerUpdate = timeSetEvent(50, 0, (LPTIMECALLBACK)TimerUpdate, (DWORD_PTR)&compareStruct, TIME_PERIODIC);
GetWindowRect(hwnd, &compareStruct.winRect);
compareStruct.regim = REGIM_INIT;
EnumChildWindows(hwnd, enum_wnd_proc, (LPARAM)(&compareStruct));
Sleep(200);
compareStruct.regim = REGIM_COMPARE;
EnumChildWindows(hwnd, enum_wnd_proc, (LPARAM)(&compareStruct));
Sleep(600);
compareStruct.regim = REGIM_RESULT;
EnumChildWindows(hwnd, enum_wnd_proc, (LPARAM)(&compareStruct));
timeKillEvent(timerUpdate);
//PostMessage(hwnd, WM_CLOSE, 0, 0);
}
else {
printf("Error: Window not found\n");
return 2;
}
}
// Запуск программы: CTRL+F5 или меню "Отладка" > "Запуск без отладки"
// Отладка программы: F5 или меню "Отладка" > "Запустить отладку"
// Советы по началу работы
// 1. В окне обозревателя решений можно добавлять файлы и управлять ими.
// 2. В окне Team Explorer можно подключиться к системе управления версиями.
// 3. В окне "Выходные данные" можно просматривать выходные данные сборки и другие сообщения.
// 4. В окне "Список ошибок" можно просматривать ошибки.
// 5. Последовательно выберите пункты меню "Проект" > "Добавить новый элемент", чтобы создать файлы кода, или "Проект" > "Добавить существующий элемент", чтобы добавить в проект существующие файлы кода.
// 6. Чтобы снова открыть этот проект позже, выберите пункты меню "Файл" > "Открыть" > "Проект" и выберите SLN-файл.

31
Compare.sln Normal file
View File

@ -0,0 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.9.34728.123
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Compare", "Compare.vcxproj", "{DE5D254B-2AB3-40E7-AF5A-92C05E2C61A5}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{DE5D254B-2AB3-40E7-AF5A-92C05E2C61A5}.Debug|x64.ActiveCfg = Debug|x64
{DE5D254B-2AB3-40E7-AF5A-92C05E2C61A5}.Debug|x64.Build.0 = Debug|x64
{DE5D254B-2AB3-40E7-AF5A-92C05E2C61A5}.Debug|x86.ActiveCfg = Debug|Win32
{DE5D254B-2AB3-40E7-AF5A-92C05E2C61A5}.Debug|x86.Build.0 = Debug|Win32
{DE5D254B-2AB3-40E7-AF5A-92C05E2C61A5}.Release|x64.ActiveCfg = Release|x64
{DE5D254B-2AB3-40E7-AF5A-92C05E2C61A5}.Release|x64.Build.0 = Release|x64
{DE5D254B-2AB3-40E7-AF5A-92C05E2C61A5}.Release|x86.ActiveCfg = Release|Win32
{DE5D254B-2AB3-40E7-AF5A-92C05E2C61A5}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {4D5EE1FF-03F9-4DF1-8EBB-27E715156027}
EndGlobalSection
EndGlobal

135
Compare.vcxproj Normal file
View File

@ -0,0 +1,135 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>17.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{de5d254b-2ab3-40e7-af5a-92c05e2c61a5}</ProjectGuid>
<RootNamespace>Compare</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="Compare.c" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

22
Compare.vcxproj.filters Normal file
View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Исходные файлы">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Файлы заголовков">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="Файлы ресурсов">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="Compare.c">
<Filter>Исходные файлы</Filter>
</ClCompile>
</ItemGroup>
</Project>

4
Compare.vcxproj.user Normal file
View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup />
</Project>

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<ProjectOutputs>
<ProjectOutput>
<FullPath>C:\VC\Compare\Release\Compare.exe</FullPath>
</ProjectOutput>
</ProjectOutputs>
<ContentFiles />
<SatelliteDlls />
<NonRecipeFileRefs />
</Project>

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,7 @@
 Compare.c
Создание кода
Создание кода завершено
2 of 6 functions (33.3%) were compiled, the rest were copied from previous compilation.
0 functions were new in current compilation
0 functions had inline decision re-evaluated but remain unchanged
Compare.vcxproj -> C:\VC\Compare\Release\Compare.exe

BIN
Compare/Release/Compare.obj Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1 @@
C:\VC\Compare\Compare.c;C:\VC\Compare\Compare\Release\Compare.obj

View File

@ -0,0 +1,2 @@
PlatformToolSet=v143:VCToolArchitecture=Native32Bit:VCToolsVersion=14.39.33519:TargetPlatformVersion=10.0.22621.0:
Release|Win32|C:\VC\Compare\|

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,3 @@
^C:\VC\COMPARE\COMPARE\RELEASE\COMPARE.OBJ
C:\VC\Compare\Compare\Release\Compare.IPDB
C:\VC\Compare\Compare\Release\Compare.iobj

Binary file not shown.

BIN
Compare/Release/vc143.pdb Normal file

Binary file not shown.

BIN
Release/Compare.exe Normal file

Binary file not shown.

BIN
Release/Compare.pdb Normal file

Binary file not shown.

BIN
Release/SLABHIDDevice.dll Normal file

Binary file not shown.

BIN
Release/SLABHIDtoUART.dll Normal file

Binary file not shown.

BIN
Release/SMM.dll Normal file

Binary file not shown.

BIN
Release/SMMpro.dll Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
Release/SoundCardMMEDAQ.dll Normal file

Binary file not shown.

BIN
Release/VTDSOF1.dll Normal file

Binary file not shown.

BIN
Release/VTDSOF1drv.dll Normal file

Binary file not shown.

BIN
Release/VTSPA.dll Normal file

Binary file not shown.