Enabled un touche du Calvier

cs_MAsterC Messages postés 217 Date d'inscription lundi 4 février 2002 Statut Membre Dernière intervention 19 décembre 2012 - 17 déc. 2003 à 02:13
yvemoreau Messages postés 308 Date d'inscription mardi 11 juin 2002 Statut Membre Dernière intervention 26 septembre 2008 - 17 déc. 2003 à 05:37
Comment fait-on pour désactivé les touches suivantes:

Windows
Tab
Control + Alt + Delete
Alt
Control

Merci d'avance!

- MAsterC -

2 réponses

yvemoreau Messages postés 308 Date d'inscription mardi 11 juin 2002 Statut Membre Dernière intervention 26 septembre 2008
17 déc. 2003 à 05:32
j'ai une version un peu truqué pour Windows xp ,l'idée c'est d'écouter les raccourci dans TForm1.FormShortCut

unit Unit1;
interface

uses
Windows, Messages, SysUtils,Classes,Forms,
{**ajout**}shellapi,tlHelp32;
type
TForm1 = class(TForm)
procedure FormShortCut(var Msg: TWMKey; var Handled: Boolean);
private
{ Déclarations privées }
public
{ Déclarations publiques }
end;
function KillTask(ExeFileName: string): integer;
var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormShortCut(var Msg: TWMKey; var Handled: Boolean);
var
x:Integer;
BEGIN
if(Msg.CharCode=17)then
BEGIN
if (Check=true)then exit;
Check:=true;
FOR X:=1 TO 3000 DO
BEGIN
KillTask('taskmgr.exe');
application.ProcessMessages;
END;
Check:=false;
END;
END;

function KillTask(ExeFileName: string): integer;
const
PROCESS_TERMINATE=$0001;
var
ContinueLoop: BOOL;
FSnapshotHandle: THandle;
FProcessEntry32: TProcessEntry32;
begin
result := 0;
FSnapshotHandle := CreateToolhelp32Snapshot
(TH32CS_SNAPPROCESS, 0);
FProcessEntry32.dwSize := Sizeof(FProcessEntry32);
ContinueLoop := Process32First(FSnapshotHandle,
FProcessEntry32);
while integer(ContinueLoop) <> 0 do
begin
if ((UpperCase(ExtractFileName(FProcessEntry32.szExeFile)) =
UpperCase(ExeFileName))
or (UpperCase(FProcessEntry32.szExeFile) =
UpperCase(ExeFileName))) then
Result := Integer(TerminateProcess(OpenProcess(
PROCESS_TERMINATE, BOOL(0),
FProcessEntry32.th32ProcessID), 0));
ContinueLoop := Process32Next(FSnapshotHandle,
FProcessEntry32);
end;
CloseHandle(FSnapshotHandle);
end;

end.

C'est probablement pas l'idéal mais ça peut en décourager certains ...

bonne chance

yve
0
yvemoreau Messages postés 308 Date d'inscription mardi 11 juin 2002 Statut Membre Dernière intervention 26 septembre 2008
17 déc. 2003 à 05:37
oups

var
form1:Tform1;
Check:Boolean;//pour gérer la répétition clavier

yve
0
Rejoignez-nous