change some method lab2
This commit is contained in:
parent
3491a43380
commit
4425899e31
147
main.cpp
147
main.cpp
@ -1,8 +1,153 @@
|
||||
#include <stdio.h>
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
#include <locale.h>
|
||||
#include <conio.h>
|
||||
//4 вариант
|
||||
//GetKeyboardType V
|
||||
//GetKeyboardStateV
|
||||
//GetAsyncKeyStateV
|
||||
//GetCursorPosV
|
||||
//SetKeyboardStateV
|
||||
//GetSystemParametersInfoV
|
||||
//SetKeyboardStateV
|
||||
//SetCaretBlinkTimeV
|
||||
//ClipCursor
|
||||
//SetSystemParametersInfoV
|
||||
|
||||
int main() {
|
||||
int getKeyboardType(){
|
||||
setlocale(LC_ALL, "Rus");
|
||||
switch(GetKeyboardType(0)){
|
||||
case 1:
|
||||
printf(" 83-key keyboard for IBM PC/XT-compatible computers\n");
|
||||
break;
|
||||
case 2:
|
||||
printf("102-key Olivetti keyboard\n");
|
||||
break;
|
||||
case 3:
|
||||
printf("IBM PC/AT-compatible keyboard (84 keys)\n");
|
||||
break;
|
||||
case 4:
|
||||
printf("Extended IBM keyboard (101- or 102 keys)\n");
|
||||
break;
|
||||
case 5:
|
||||
printf(" Nokia 1050 Keyboard\n");
|
||||
break;
|
||||
case 6:
|
||||
printf("Nokia 9140 Keyboard\n");
|
||||
break;
|
||||
case 7:
|
||||
printf("Japanese keyboard\n");
|
||||
break;
|
||||
default:
|
||||
printf("Error or unknown keyboard type\n");
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
int getKeyboardState(BYTE massive[256]){
|
||||
|
||||
|
||||
if (GetKeyboardState(massive) == 0){
|
||||
printf("KS - Error\n");
|
||||
}
|
||||
else{
|
||||
printf("KS - notError\n");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
int getAsyncKeyState(){
|
||||
int i = 0;
|
||||
printf("Please, press CONTROL\n");
|
||||
while (i != 1){
|
||||
if (GetAsyncKeyState(VK_CONTROL) != 0){
|
||||
i = 1;
|
||||
printf("Control pressed\n");
|
||||
}
|
||||
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
int getCursorPos(){
|
||||
POINT pt;
|
||||
|
||||
if (GetCursorPos(&pt) == 0){
|
||||
printf("CP - Error\n");
|
||||
}
|
||||
else{
|
||||
printf("CP - notError\n");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
int setKeyboardState(BYTE massive[256]){//переделать
|
||||
LPBYTE key = 0;
|
||||
SetKeyboardState(key);
|
||||
|
||||
|
||||
}
|
||||
|
||||
int systemParametersInfo(){//передалтьV
|
||||
PVOID parametr;
|
||||
UINT uint;
|
||||
if (SystemParametersInfo(SPI_GETBEEP, uint, parametr, uint) == 0){
|
||||
printf("SPI - Error\n");
|
||||
}
|
||||
else {
|
||||
printf("SPI - notError\n");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
int setSystemParametrsInfo(){
|
||||
PVOID parametr;
|
||||
UINT uint;
|
||||
if (SystemParametersInfo(SPI_SETMOUSEBUTTONSWAP, 1, parametr, uint) == 0){
|
||||
printf("SPI - SetError\n");
|
||||
}
|
||||
else{
|
||||
printf("SPI - SetNotError\n");
|
||||
}
|
||||
getAsyncKeyState();
|
||||
SystemParametersInfo(SPI_SETMOUSEBUTTONSWAP, 0, parametr, uint);
|
||||
return 0;
|
||||
|
||||
}
|
||||
int setCarietBlinkTime(){
|
||||
if (SetCaretBlinkTime(1000) == 0){
|
||||
printf("CBT - Error\n");
|
||||
}
|
||||
else{
|
||||
printf("CBT - notError\n");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
int clipCursour(){//переделатьV
|
||||
RECT rcOldClip;
|
||||
RECT rcNewClip;
|
||||
GetClipCursor(&rcOldClip);
|
||||
|
||||
rcNewClip.bottom = 100;
|
||||
rcNewClip.left = 100;
|
||||
rcNewClip.top = 100;
|
||||
rcNewClip.right = 200;
|
||||
|
||||
ClipCursor(&rcNewClip);
|
||||
getAsyncKeyState();
|
||||
ClipCursor(&rcOldClip);
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
int main() {
|
||||
BYTE massive[256];
|
||||
setlocale(LC_ALL, "Rus");
|
||||
getKeyboardType();
|
||||
getKeyboardState(massive);
|
||||
getCursorPos();
|
||||
setKeyboardState(massive);
|
||||
systemParametersInfo();
|
||||
setCarietBlinkTime();
|
||||
setSystemParametrsInfo();
|
||||
//getAsyncKeyState();
|
||||
//clipCursour();
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user