end;
function ShiftDown : Boolean;
var
State : TKeyboardState;
begin
GetKeyboardState(State);
Result := ((State[vk_Shift] and 128) <> 0);
end;
function AltDown : Boolean;
var
State : TKeyboardState;
begin
GetKeyboardState(State);
Result := ((State[vk_Menu] and 128) <> 0);
end;
Қўллашга мисол.
procedure TForm1.Button1Click(Sender: TObject);
begin
if ShiftDown then
Form1.Caption := 'Shift'
else
Form1.Caption := '';
end;
Тугмани дастурий босиш
private
{ Private declarations }
procedure SetKey(Key:Integer);
procedure TForm1.SetKey(Key:Integer);
begin
keybd_event(Key,0,KEYEVENTF_EXTENDEDKEY or KEYEVENTF_KEYUP,0);
keybd_event(Key,0,KEYEVENTF_EXTENDEDKEY,0);
keybd_event(Key,0,KEYEVENTF_EXTENDEDKEY or KEYEVENTF_KEYUP,0);
end;
CapsLock холатини (ёниқ ёки ўчиқлигини) аниқлаш
procedure TForm1.Timer1Timer(Sender: TObject);
begin
if GetKeyState(VK_CAPITAL) and 1 = 0 then
Form1.Caption := 'Caps lock ўчган'
else
Form1.Caption := 'Caps lock ёнган';
end;
Компьютер билан ишлаш
Компьютерни ўчириш ёки қайта юклаш
Компьютерни ўчириш буйруғи
ExitWindowsEx(EWX_LOGOFF or ewx_force,0);
|
Маълумотларни сақлаган ҳолда ўчириш буйруғи
ExitWindowsEx(EWX_SHUTDOWN or ewx_force,0);
|
Do'stlaringiz bilan baham: |