Lab2
This commit is contained in:
parent
972da7a375
commit
45ee25ee5f
31
Project2/Project1.sln
Normal file
31
Project2/Project1.sln
Normal file
@ -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
|
1
Project2/Project1/Old.txt
Normal file
1
Project2/Project1/Old.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
old
|
136
Project2/Project1/Project1.vcxproj
Normal file
136
Project2/Project1/Project1.vcxproj
Normal file
@ -0,0 +1,136 @@
|
|||||||
|
<?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>16.0</VCProjectVersion>
|
||||||
|
<Keyword>Win32Proj</Keyword>
|
||||||
|
<ProjectGuid>{73fd34d1-9a70-4ec7-bb6c-61b4e6503125}</ProjectGuid>
|
||||||
|
<RootNamespace>Project1</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>
|
||||||
|
<CompileAs>CompileAsC</CompileAs>
|
||||||
|
</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="hello.c" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
</ImportGroup>
|
||||||
|
</Project>
|
22
Project2/Project1/Project1.vcxproj.filters
Normal file
22
Project2/Project1/Project1.vcxproj.filters
Normal 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="hello.c">
|
||||||
|
<Filter>Файлы ресурсов</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
116
Project2/Project1/hello.c
Normal file
116
Project2/Project1/hello.c
Normal file
@ -0,0 +1,116 @@
|
|||||||
|
#define _CRT_SECURE_NO_WARNINGS
|
||||||
|
#include <windows.h>
|
||||||
|
#include <direct.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <tchar.h>
|
||||||
|
#include <locale.h>
|
||||||
|
#include <conio.h>
|
||||||
|
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
0
Project2/Project1/text.txt
Normal file
0
Project2/Project1/text.txt
Normal file
0
Project2/Project1/text2.txt
Normal file
0
Project2/Project1/text2.txt
Normal file
Loading…
Reference in New Issue
Block a user