change some method lab2

This commit is contained in:
fasadar2 2023-10-26 15:29:51 +03:00
parent 4425899e31
commit 09ba73446a

View File

@ -17,6 +17,7 @@
int getKeyboardType(){ int getKeyboardType(){
setlocale(LC_ALL, "Rus"); setlocale(LC_ALL, "Rus");
printf("Keyboard type: ");
switch(GetKeyboardType(0)){ switch(GetKeyboardType(0)){
case 1: case 1:
printf(" 83-key keyboard for IBM PC/XT-compatible computers\n"); printf(" 83-key keyboard for IBM PC/XT-compatible computers\n");
@ -48,12 +49,24 @@ int getKeyboardType(){
int getKeyboardState(BYTE massive[256]){ int getKeyboardState(BYTE massive[256]){
if (GetKeyboardState(massive) == 0){
if (GetKeyboardState(massive) == 0)
{
printf("KS - Error\n"); printf("KS - Error\n");
} }
else{ else
{
printf("KS - notError\n"); printf("KS - notError\n");
} }
if (massive[VK_CONTROL] & 0x80)
{
printf("CONTROL has been pressed\n");
}
else
{
printf("CONTROL not been pressed\n");
}
return 0; return 0;
} }
int getAsyncKeyState(){ int getAsyncKeyState(){
@ -79,20 +92,23 @@ int getCursorPos(){
} }
return 0; return 0;
} }
int setKeyboardState(BYTE massive[256]){//переделать int setKeyboardState(){//переделать
LPBYTE key = 0; BYTE state[256];
SetKeyboardState(key); state[VK_CONTROL] = 0x80;
SetKeyboardState(state);
getKeyboardState(state);
return 0;
} }
int systemParametersInfo(){//передалтьV int systemParametersInfo(){//передалтьV
PVOID parametr; PVOID parametr;
UINT uint; UINT uint;
if (SystemParametersInfo(SPI_GETBEEP, uint, parametr, uint) == 0){ if (SystemParametersInfo(SPI_GETBEEP, uint, parametr, uint) ==0)
{
printf("SPI - Error\n"); printf("SPI - Error\n");
} }
else { else
{
printf("SPI - notError\n"); printf("SPI - notError\n");
} }
return 0; return 0;
@ -138,16 +154,16 @@ int clipCursour(){//переделатьV
} }
int main() { int main() {
BYTE massive[256]; BYTE massive[256];
setlocale(LC_ALL, "Rus"); setlocale(LC_ALL, "Rus");
getKeyboardType(); getKeyboardType();
getKeyboardState(massive); getKeyboardState(massive);
getCursorPos(); getCursorPos();
setKeyboardState(massive); setKeyboardState();
systemParametersInfo(); systemParametersInfo();
setCarietBlinkTime(); setCarietBlinkTime();
setSystemParametrsInfo(); setSystemParametrsInfo();
//getAsyncKeyState();
//clipCursour(); //clipCursour();
return 0; return 0;
} }