From 45ee25ee5f1f4b3aff7719a95693a60655daba35 Mon Sep 17 00:00:00 2001 From: Ivan2567 <78481838+Ivan2567@users.noreply.github.com> Date: Thu, 23 Nov 2023 01:35:15 +0300 Subject: [PATCH] Lab2 --- Project2/Project1.sln | 31 +++++ Project2/Project1/Old.txt | 1 + Project2/Project1/Project1.vcxproj | 136 +++++++++++++++++++++ Project2/Project1/Project1.vcxproj.filters | 22 ++++ Project2/Project1/hello.c | 116 ++++++++++++++++++ Project2/Project1/text.txt | 0 Project2/Project1/text2.txt | 0 7 files changed, 306 insertions(+) create mode 100644 Project2/Project1.sln create mode 100644 Project2/Project1/Old.txt create mode 100644 Project2/Project1/Project1.vcxproj create mode 100644 Project2/Project1/Project1.vcxproj.filters create mode 100644 Project2/Project1/hello.c create mode 100644 Project2/Project1/text.txt create mode 100644 Project2/Project1/text2.txt diff --git a/Project2/Project1.sln b/Project2/Project1.sln new file mode 100644 index 0000000..fc52006 --- /dev/null +++ b/Project2/Project1.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.2.32602.215 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Project1", "Project1\Project1.vcxproj", "{73FD34D1-9A70-4EC7-BB6C-61B4E6503125}" +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 + {73FD34D1-9A70-4EC7-BB6C-61B4E6503125}.Debug|x64.ActiveCfg = Debug|x64 + {73FD34D1-9A70-4EC7-BB6C-61B4E6503125}.Debug|x64.Build.0 = Debug|x64 + {73FD34D1-9A70-4EC7-BB6C-61B4E6503125}.Debug|x86.ActiveCfg = Debug|Win32 + {73FD34D1-9A70-4EC7-BB6C-61B4E6503125}.Debug|x86.Build.0 = Debug|Win32 + {73FD34D1-9A70-4EC7-BB6C-61B4E6503125}.Release|x64.ActiveCfg = Release|x64 + {73FD34D1-9A70-4EC7-BB6C-61B4E6503125}.Release|x64.Build.0 = Release|x64 + {73FD34D1-9A70-4EC7-BB6C-61B4E6503125}.Release|x86.ActiveCfg = Release|Win32 + {73FD34D1-9A70-4EC7-BB6C-61B4E6503125}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {02C511CF-3283-4A24-ABEE-DB5811E8294C} + EndGlobalSection +EndGlobal diff --git a/Project2/Project1/Old.txt b/Project2/Project1/Old.txt new file mode 100644 index 0000000..489ce0f --- /dev/null +++ b/Project2/Project1/Old.txt @@ -0,0 +1 @@ +old \ No newline at end of file diff --git a/Project2/Project1/Project1.vcxproj b/Project2/Project1/Project1.vcxproj new file mode 100644 index 0000000..0649d6e --- /dev/null +++ b/Project2/Project1/Project1.vcxproj @@ -0,0 +1,136 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 16.0 + Win32Proj + {73fd34d1-9a70-4ec7-bb6c-61b4e6503125} + Project1 + 10.0 + + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + + + + + + + + + + + + + + + + + + + + Level3 + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + Level3 + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + CompileAsC + + + Console + true + + + + + Level3 + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + + + + + \ No newline at end of file diff --git a/Project2/Project1/Project1.vcxproj.filters b/Project2/Project1/Project1.vcxproj.filters new file mode 100644 index 0000000..79d4255 --- /dev/null +++ b/Project2/Project1/Project1.vcxproj.filters @@ -0,0 +1,22 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Файлы ресурсов + + + \ No newline at end of file diff --git a/Project2/Project1/hello.c b/Project2/Project1/hello.c new file mode 100644 index 0000000..38ac199 --- /dev/null +++ b/Project2/Project1/hello.c @@ -0,0 +1,116 @@ +#define _CRT_SECURE_NO_WARNINGS +#include +#include +#include +#include +#include +#include + + +TCHAR szDrive[] = _T(" A:"); + +int main() +{ + setlocale(LC_ALL, "ru_RU.UTF8"); + SetConsoleOutputCP(65001); + SetConsoleCP(65001); + + + //getKeyboardState(); + //getKeyState(); + //getAsyncKeyState(); + setclipCursor(); + //swapMouseButton(); + return 0; +} + +int getKeyboardState() { + BYTE keystate[256]; static prevKeys[256]; + if (GetKeyboardState(keystate)) + wprintf(L"Успешно получен статус клавиш\n"); + else + wprintf(L"Не получен статус клавиш\n"); + + wprintf(L"Статус левой кнопки мыши: "); + if ((GetAsyncKeyState(VK_LBUTTON) & 0x8000) != 0) + wprintf(L"Активна \n"); + else + wprintf(L"Неактивна\n"); + + wprintf(L"Статус левго CONTROL: "); + if ((GetAsyncKeyState(VK_LCONTROL) & 0x8000) != 0) + wprintf(L"Активен\n"); + else + wprintf(L"Неактивен\n"); + return 0; +} + +int getKeyState() { + while (TRUE) + { + SHORT keyState = GetKeyState(VK_SPACE); + //if (keyState & 0x8000) + if (keyState) + { + system("cls"); + wprintf(L"Нажат Пробел"); + } + } + return 0; +} + +int getAsyncKeyState() { + POINT pt; + while (TRUE) { + if (GetAsyncKeyState(VK_LBUTTON) & 1) + { + system("cls"); + wprintf(L"Нажата левая кнопка мыши\n"); + GetCursorPos(&pt); + wprintf(L"Коорднаты курсора: %d,%d\n", pt.x, pt.y); + } + if (GetAsyncKeyState(VK_RBUTTON) & 1) + { + system("cls"); + wprintf(L"Нажата правая кнопка мыши\n"); + GetCursorPos(&pt); + wprintf(L"Коорднаты курсора: %d,%d\n", pt.x, pt.y); + } + if (GetAsyncKeyState(VK_ESCAPE) & 0x8000) { + system("cls"); + wprintf(L"Нажат Выход"); + break; + } + } + return 0; +} + +int setclipCursor() { + wprintf(L"Ограничение курсора: включено\n"); + SetCaretBlinkTime(1000); + SetCursorPos(0, 0); + RECT r; + char string[10] = ""; + r.left = 100; + r.top = 100; + r.right = 200; + r.bottom = 200; + ClipCursor(&r); + wprintf(L"Для снятия ведите любой символ с клавиатуры\n"); + scanf(" %s", string); + ClipCursor(NULL); + //SetCaretBlinkTime(1000); + wprintf(L"Ограничение курсора: выключено\n"); + return 0; +} +int swapMouseButton() { + wprintf(L"Метрика перестановки кнопок мыши: %d\n",GetSystemMetrics(SM_SWAPBUTTON)); + SwapMouseButton(TRUE); + wprintf(L"Метрика перестановки кнопок мыши: %d\n", GetSystemMetrics(SM_SWAPBUTTON)); + char string[10] = ""; + wprintf(L"Для отмены ведите любой символ с клавиатуры\n"); + scanf(" %s", string); + SwapMouseButton(FALSE); + wprintf(L"Метрика перестановки кнопок мыши: %d\n", GetSystemMetrics(SM_SWAPBUTTON)); + return 0; +} \ No newline at end of file diff --git a/Project2/Project1/text.txt b/Project2/Project1/text.txt new file mode 100644 index 0000000..e69de29 diff --git a/Project2/Project1/text2.txt b/Project2/Project1/text2.txt new file mode 100644 index 0000000..e69de29