Добавьте файлы проекта.
This commit is contained in:
		
							parent
							
								
									72ce4d34a6
								
							
						
					
					
						commit
						834bc9763b
					
				
							
								
								
									
										31
									
								
								2-лабораторная.sln
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								2-лабораторная.sln
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,31 @@
 | 
			
		||||
 | 
			
		||||
Microsoft Visual Studio Solution File, Format Version 12.00
 | 
			
		||||
# Visual Studio Version 17
 | 
			
		||||
VisualStudioVersion = 17.7.34221.43
 | 
			
		||||
MinimumVisualStudioVersion = 10.0.40219.1
 | 
			
		||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "2-лабораторная", "2-лабораторная.vcxproj", "{A2BC3EC1-EEDF-49D6-8CF8-6E2729DC8314}"
 | 
			
		||||
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
 | 
			
		||||
		{A2BC3EC1-EEDF-49D6-8CF8-6E2729DC8314}.Debug|x64.ActiveCfg = Debug|x64
 | 
			
		||||
		{A2BC3EC1-EEDF-49D6-8CF8-6E2729DC8314}.Debug|x64.Build.0 = Debug|x64
 | 
			
		||||
		{A2BC3EC1-EEDF-49D6-8CF8-6E2729DC8314}.Debug|x86.ActiveCfg = Debug|Win32
 | 
			
		||||
		{A2BC3EC1-EEDF-49D6-8CF8-6E2729DC8314}.Debug|x86.Build.0 = Debug|Win32
 | 
			
		||||
		{A2BC3EC1-EEDF-49D6-8CF8-6E2729DC8314}.Release|x64.ActiveCfg = Release|x64
 | 
			
		||||
		{A2BC3EC1-EEDF-49D6-8CF8-6E2729DC8314}.Release|x64.Build.0 = Release|x64
 | 
			
		||||
		{A2BC3EC1-EEDF-49D6-8CF8-6E2729DC8314}.Release|x86.ActiveCfg = Release|Win32
 | 
			
		||||
		{A2BC3EC1-EEDF-49D6-8CF8-6E2729DC8314}.Release|x86.Build.0 = Release|Win32
 | 
			
		||||
	EndGlobalSection
 | 
			
		||||
	GlobalSection(SolutionProperties) = preSolution
 | 
			
		||||
		HideSolutionNode = FALSE
 | 
			
		||||
	EndGlobalSection
 | 
			
		||||
	GlobalSection(ExtensibilityGlobals) = postSolution
 | 
			
		||||
		SolutionGuid = {783A30ED-544A-488B-A9C1-54377254C64B}
 | 
			
		||||
	EndGlobalSection
 | 
			
		||||
EndGlobal
 | 
			
		||||
							
								
								
									
										135
									
								
								2-лабораторная.vcxproj
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										135
									
								
								2-лабораторная.vcxproj
									
									
									
									
									
										Normal 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>
 | 
			
		||||
  <ItemGroup>
 | 
			
		||||
    <ClCompile Include="main.c" />
 | 
			
		||||
  </ItemGroup>
 | 
			
		||||
  <PropertyGroup Label="Globals">
 | 
			
		||||
    <VCProjectVersion>17.0</VCProjectVersion>
 | 
			
		||||
    <Keyword>Win32Proj</Keyword>
 | 
			
		||||
    <ProjectGuid>{a2bc3ec1-eedf-49d6-8cf8-6e2729dc8314}</ProjectGuid>
 | 
			
		||||
    <RootNamespace>My2лабораторная</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>
 | 
			
		||||
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
 | 
			
		||||
  <ImportGroup Label="ExtensionTargets">
 | 
			
		||||
  </ImportGroup>
 | 
			
		||||
</Project>
 | 
			
		||||
							
								
								
									
										22
									
								
								2-лабораторная.vcxproj.filters
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								2-лабораторная.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="main.c">
 | 
			
		||||
      <Filter>Исходные файлы</Filter>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
  </ItemGroup>
 | 
			
		||||
</Project>
 | 
			
		||||
							
								
								
									
										191
									
								
								main.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										191
									
								
								main.c
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,191 @@
 | 
			
		||||
 | 
			
		||||
#define _CRT_SECURE_NO_WARNINGS
 | 
			
		||||
//#define _UNICODE
 | 
			
		||||
//#define UNICODE
 | 
			
		||||
 | 
			
		||||
#include <windows.h>
 | 
			
		||||
#include <direct.h>
 | 
			
		||||
#include <fcntl.h>
 | 
			
		||||
#include <io.h>
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include <tchar.h>
 | 
			
		||||
#include <locale.h>
 | 
			
		||||
#include <string.h> 
 | 
			
		||||
#include <wchar.h>
 | 
			
		||||
#include <sys/types.h>
 | 
			
		||||
#include <sys/stat.h>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void printGetKeyboardType();
 | 
			
		||||
void printGetAsyncKeyState();
 | 
			
		||||
void printGetKeyState();
 | 
			
		||||
void printGetKeyboardState();
 | 
			
		||||
void printGetCaretBlinkTime();
 | 
			
		||||
void printGetSystemMetrics();
 | 
			
		||||
void printShowCursor();
 | 
			
		||||
void printSetCaretBlinkTime();
 | 
			
		||||
 | 
			
		||||
int main(void)
 | 
			
		||||
{
 | 
			
		||||
    // ïðîãðàììà òîëüêî äëÿ UNICODE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 | 
			
		||||
    const wchar_t str[] = L"help";
 | 
			
		||||
    const wchar_t str1[] = L"exit";
 | 
			
		||||
    const wchar_t str2[] = L"getKey";
 | 
			
		||||
    const wchar_t str3[] = L"asyncKey";
 | 
			
		||||
    const wchar_t str4[] = L"getK";
 | 
			
		||||
    const wchar_t str5[] = L"getC";
 | 
			
		||||
    const wchar_t str6[] = L"getS";
 | 
			
		||||
    const wchar_t str7[] = L"showC";
 | 
			
		||||
    const wchar_t str8[] = L"setC";
 | 
			
		||||
    const wchar_t str9[] = L"type";
 | 
			
		||||
    _setmode(_fileno(stdin), _O_U16TEXT);
 | 
			
		||||
    _setmode(_fileno(stdout), _O_U16TEXT);
 | 
			
		||||
    _setmode(_fileno(stderr), _O_U16TEXT);
 | 
			
		||||
    printGetKeyboardState();
 | 
			
		||||
    wchar_t comand[50];
 | 
			
		||||
    //setlocale(LC_ALL, ".UTF8");
 | 
			
		||||
    _tprintf(_T("Çäðàâñòâóéòå, â ñâÿçè ñ àòàêîé òåððîðèñòîâ íà ìîå âîîáðàæåíèå ýòà ïðîãðàììà ïîëó÷èëà íàçâàíèå \"Ïðîãðàììà2\"\n"));
 | 
			
		||||
    while (1) { 
 | 
			
		||||
    _tprintf(_T("Ââåäèòå êîìàíäó: "));
 | 
			
		||||
    fgetws(comand,sizeof(comand), stdin);
 | 
			
		||||
    comand[wcslen(comand) - 1] = 0;  
 | 
			
		||||
     if(!wcscmp(comand, str)) {
 | 
			
		||||
         _tprintf(_T("Òóò äîëæåí áûòü ñïèñîê äîñòóïíûõ êîìàíä, íî åãî íåò - êàê æàëü(\n"));  
 | 
			
		||||
     }
 | 
			
		||||
     else if (!wcscmp(comand, str2)) {
 | 
			
		||||
          printGetKeyState();
 | 
			
		||||
     }
 | 
			
		||||
     else if (!wcscmp(comand, str3)) {
 | 
			
		||||
         printGetAsyncKeyState();
 | 
			
		||||
     }
 | 
			
		||||
     else if (!wcscmp(comand, str5)) {
 | 
			
		||||
         printGetCaretBlinkTime();
 | 
			
		||||
     }
 | 
			
		||||
     else if (!wcscmp(comand, str6)) {
 | 
			
		||||
         printGetSystemMetrics();
 | 
			
		||||
     }
 | 
			
		||||
     else if (!wcscmp(comand, str7)) {
 | 
			
		||||
         printShowCursor();
 | 
			
		||||
     }
 | 
			
		||||
     else if (!wcscmp(comand, str8)) {
 | 
			
		||||
         printSetCaretBlinkTime();
 | 
			
		||||
     }
 | 
			
		||||
     else if (!wcscmp(comand, str9)) {
 | 
			
		||||
         printGetKeyboardType();
 | 
			
		||||
     }
 | 
			
		||||
    
 | 
			
		||||
     
 | 
			
		||||
     else if (!wcscmp(comand, str1)) {
 | 
			
		||||
         _tprintf(_T("Ïðîèçîøåë âûõîä èç ïðîãðàììû!\n"));
 | 
			
		||||
         break;
 | 
			
		||||
     }  
 | 
			
		||||
     else if (!wcscmp(comand, str4)) {
 | 
			
		||||
         printGetKeyboardState();
 | 
			
		||||
     }
 | 
			
		||||
     else {
 | 
			
		||||
         _tprintf(_T("Íåâåðíàÿ êîìàíäà!\n"));
 | 
			
		||||
 | 
			
		||||
     }
 | 
			
		||||
    }
 | 
			
		||||
	return 0;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void printGetKeyboardType() {
 | 
			
		||||
    int type = GetKeyboardType(0);
 | 
			
		||||
    if (type == 0x4) {
 | 
			
		||||
        _tprintf(_T("Óëó÷øåííûå êëàâèàòóðû ñî 101 èëè 102 êëàâèøàìè (è ñîâìåñòèìûå) \n"));
 | 
			
		||||
    }
 | 
			
		||||
    else if (type == 0x7) {
 | 
			
		||||
        _tprintf(_T("ßïîíñêàÿ êëàâèàòóðà\n"));
 | 
			
		||||
    }
 | 
			
		||||
    else if (type == 0x8) {
 | 
			
		||||
        _tprintf(_T("Êîðåéñêàÿ êëàâèàòóðà\n"));
 | 
			
		||||
    }
 | 
			
		||||
    else {
 | 
			
		||||
        DWORD error = GetLastError();
 | 
			
		||||
        _tprintf(_T("Íåèçâåñòíûé òèï êëàâèàòóðû. Êîä îøèáêè: \n", error));
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
void printGetKeyState() {
 | 
			
		||||
    SHORT ks;
 | 
			
		||||
    while ((GetKeyState('S') & 0x8000) == 0) {
 | 
			
		||||
    }
 | 
			
		||||
    _tprintf(_T("Êëàâèøà S íàæàòà \n"));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void printGetAsyncKeyState() {
 | 
			
		||||
    while ((GetAsyncKeyState('R') & 0x8001) == 0) {
 | 
			
		||||
    }
 | 
			
		||||
    _tprintf(_T("Êëàâèøà R íàæàòà \n"));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void printGetKeyboardState() {
 | 
			
		||||
    _tprintf(_T("Íàæìè íà SHIFT!\n"));
 | 
			
		||||
    BYTE keyboardState[256];
 | 
			
		||||
    while (1) {
 | 
			
		||||
        GetKeyState(0);                                                        // ÷òîáû âñå ðàáîòàëî! 
 | 
			
		||||
        GetKeyboardState(keyboardState);
 | 
			
		||||
        if (keyboardState[VK_LBUTTON] & 0x80) {                                  // 0õ80 ýòî ñðàâíèâàåì ñòàðøèé áèò â 16-é ñèñòåìå
 | 
			
		||||
            _tprintf(_T("Êëàâèøà SHIFT íàæàòà \n"), keyboardState);
 | 
			
		||||
            Sleep(100);                                                        // ÷òîáû ìíîãî íå âûâîäèëî ïðè íàæàòèè
 | 
			
		||||
            break;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void printGetCaretBlinkTime() {
 | 
			
		||||
    UINT blinkTime = GetCaretBlinkTime();
 | 
			
		||||
    _tprintf(_T("Ñòàíäàðòíûé èíòåðâàë âðåìåíè ìèãàíèÿ êóðñîðà: %ld\n"), blinkTime);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void printGetSystemMetrics() {
 | 
			
		||||
    int width = GetSystemMetrics(SM_CXSCREEN);
 | 
			
		||||
    int height = GetSystemMetrics(SM_CYSCREEN);
 | 
			
		||||
    _tprintf(_T("Ðàçðåøåíèå ýêðàíà: %d íà %d\n "), width, height);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void printShowCursor() {
 | 
			
		||||
    BOOL cursor = 0;
 | 
			
		||||
    int s;
 | 
			
		||||
    while ((GetAsyncKeyState(VK_ESCAPE) & 0x81) == 0) {
 | 
			
		||||
        if (cursor) {
 | 
			
		||||
            s = ShowCursor(TRUE);
 | 
			
		||||
            _tprintf(_T("Êóðñîð âèäèì %d"),s);
 | 
			
		||||
        }
 | 
			
		||||
        else {
 | 
			
		||||
           s =  ShowCursor(FALSE);
 | 
			
		||||
            _tprintf(_T("Êóðñîð íå âèäèì %d"),s);
 | 
			
		||||
        }
 | 
			
		||||
        cursor = !cursor;
 | 
			
		||||
        Sleep(1000);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void printSetCaretBlinkTime() {
 | 
			
		||||
    UINT blinkTime = 2000;
 | 
			
		||||
    if (SetCaretBlinkTime(blinkTime)) {
 | 
			
		||||
        _tprintf(_T("Èíòåðâàë âðåìåíè ìèãàíèÿ êóðñîðà èçìåíåí íà: %dìñ \n"), blinkTime);
 | 
			
		||||
    }
 | 
			
		||||
    else {
 | 
			
		||||
        _tprintf(_T("Íå óäàëîñü èçìåíèòü èíòåðâàë ìèãàíèÿ êóðñîðà \n"));
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void printClipCursor() {
 | 
			
		||||
    RECT clipRect = { 0, 0, 800, 600 };
 | 
			
		||||
    //RECT fullClipRect = { 0, 0, 1920, 1200 };
 | 
			
		||||
    if (ClipCursor(&clipRect)) {
 | 
			
		||||
        _tprintf(_T("Äâèæåíèå êóðñîðà îãðàíè÷åíî %d ïî %d\n"), clipRect.right, clipRect.bottom);
 | 
			
		||||
        Sleep(5000);
 | 
			
		||||
        //_tprintf(_T("Äâèæåíèå êóðñîðà óâåëè÷åíî %d ïî %d\n"), fullClipRect.right, fullClipRect.bottom);
 | 
			
		||||
        ClipCursor(NULL);
 | 
			
		||||
    }
 | 
			
		||||
    else {
 | 
			
		||||
        _tprintf(_T("Êàêàÿ-òî ëàæà\n"));
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user