Skip to content

Commit 5517d16

Browse files
Initial commit
0 parents  commit 5517d16

File tree

7 files changed

+292
-0
lines changed

7 files changed

+292
-0
lines changed

KeyLock.cfg

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
-$A8
2+
-$B-
3+
-$C-
4+
-$D-
5+
-$E-
6+
-$F-
7+
-$G+
8+
-$H+
9+
-$I+
10+
-$J-
11+
-$K-
12+
-$L-
13+
-$M-
14+
-$N+
15+
-$O+
16+
-$P+
17+
-$Q-
18+
-$R-
19+
-$S-
20+
-$T-
21+
-$U-
22+
-$V+
23+
-$W-
24+
-$X+
25+
-$Y-
26+
-$Z1
27+
-cg
28+
-AWinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
29+
-H+
30+
-W+
31+
-M
32+
-$M16384,1048576
33+
-K$00400000
34+
-LE"c:\program files\borland\delphi7\Projects\Bpl"
35+
-LN"c:\program files\borland\delphi7\Projects\Bpl"

KeyLock.dof

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
[FileVersion]
2+
Version=7.0
3+
[Compiler]
4+
A=8
5+
B=0
6+
C=0
7+
D=0
8+
E=0
9+
F=0
10+
G=1
11+
H=1
12+
I=1
13+
J=0
14+
K=0
15+
L=0
16+
M=0
17+
N=1
18+
O=1
19+
P=1
20+
Q=0
21+
R=0
22+
S=0
23+
T=0
24+
U=0
25+
V=1
26+
W=0
27+
X=1
28+
Y=0
29+
Z=1
30+
ShowHints=1
31+
ShowWarnings=1
32+
UnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
33+
NamespacePrefix=
34+
SymbolDeprecated=1
35+
SymbolLibrary=1
36+
SymbolPlatform=1
37+
UnitLibrary=1
38+
UnitPlatform=1
39+
UnitDeprecated=1
40+
HResultCompat=1
41+
HidingMember=1
42+
HiddenVirtual=1
43+
Garbage=1
44+
BoundsError=1
45+
ZeroNilCompat=1
46+
StringConstTruncated=1
47+
ForLoopVarVarPar=1
48+
TypedConstVarPar=1
49+
AsgToTypedConst=1
50+
CaseLabelRange=1
51+
ForVariable=1
52+
ConstructingAbstract=1
53+
ComparisonFalse=1
54+
ComparisonTrue=1
55+
ComparingSignedUnsigned=1
56+
CombiningSignedUnsigned=1
57+
UnsupportedConstruct=1
58+
FileOpen=1
59+
FileOpenUnitSrc=1
60+
BadGlobalSymbol=1
61+
DuplicateConstructorDestructor=1
62+
InvalidDirective=1
63+
PackageNoLink=1
64+
PackageThreadVar=1
65+
ImplicitImport=1
66+
HPPEMITIgnored=1
67+
NoRetVal=1
68+
UseBeforeDef=1
69+
ForLoopVarUndef=1
70+
UnitNameMismatch=1
71+
NoCFGFileFound=1
72+
MessageDirective=1
73+
ImplicitVariants=1
74+
UnicodeToLocale=1
75+
LocaleToUnicode=1
76+
ImagebaseMultiple=1
77+
SuspiciousTypecast=1
78+
PrivatePropAccessor=1
79+
UnsafeType=1
80+
UnsafeCode=1
81+
UnsafeCast=1
82+
[Linker]
83+
MapFile=0
84+
OutputObjs=0
85+
ConsoleApp=1
86+
DebugInfo=0
87+
RemoteSymbols=0
88+
MinStackSize=16384
89+
MaxStackSize=1048576
90+
ImageBase=4194304
91+
ExeDescription=
92+
[Directories]
93+
OutputDir=
94+
UnitOutputDir=
95+
PackageDLLOutputDir=
96+
PackageDCPOutputDir=
97+
SearchPath=
98+
Packages=vcl;rtl;dbrtl;adortl;vcldb;vclx;bdertl;vcldbx;ibxpress;dsnap;cds;bdecds;qrpt;teeui;teedb;tee;dss;teeqr;visualclx;visualdbclx;dsnapcrba;dsnapcon;VclSmp;vclshlctrls;vclie;xmlrtl;inet;inetdbbde;inetdbxpress;inetdb;nmfast;webdsnap;websnap;dbexpress;dbxcds;indy;dclOffice2k;UltraPackage;CRControls60;dac60;dacvcl60;odacvcl60;odac60;oraprov60
99+
Conditionals=
100+
DebugSourceDirs=
101+
UsePackages=0
102+
[Parameters]
103+
RunParams=
104+
HostApplication=
105+
Launcher=
106+
UseLauncher=0
107+
DebugCWD=
108+
[Language]
109+
ActiveLang=
110+
ProjectLang=
111+
RootDir=C:\Program Files\Borland\Delphi6\Bin\
112+
[Version Info]
113+
IncludeVerInfo=0
114+
AutoIncBuild=0
115+
MajorVer=1
116+
MinorVer=0
117+
Release=0
118+
Build=0
119+
Debug=0
120+
PreRelease=0
121+
Special=0
122+
Private=0
123+
DLL=0
124+
Locale=1049
125+
CodePage=1251
126+
[Version Info Keys]
127+
CompanyName=
128+
FileDescription=
129+
FileVersion=1.0.0.0
130+
InternalName=
131+
LegalCopyright=
132+
LegalTrademarks=
133+
OriginalFilename=
134+
ProductName=
135+
ProductVersion=1.0.0.0
136+
Comments=

KeyLock.dpr

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
program KeyLock;
2+
3+
uses
4+
Forms,
5+
MainUnit in 'MainUnit.pas' {MainForm};
6+
7+
{$R *.res}
8+
9+
begin
10+
Application.Initialize;
11+
Application.CreateForm(TMainForm, MainForm);
12+
Application.Run;
13+
end.

KeyLock.exe

366 KB
Binary file not shown.

KeyLock.res

2.29 KB
Binary file not shown.

MainUnit.dfm

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
object MainForm: TMainForm
2+
Left = 347
3+
Top = 240
4+
BorderStyle = bsSingle
5+
ClientHeight = 129
6+
ClientWidth = 127
7+
Color = clBtnFace
8+
Font.Charset = DEFAULT_CHARSET
9+
Font.Color = clWindowText
10+
Font.Height = -11
11+
Font.Name = 'MS Sans Serif'
12+
Font.Style = []
13+
FormStyle = fsStayOnTop
14+
OldCreateOrder = False
15+
OnClose = FormClose
16+
OnCreate = FormCreate
17+
PixelsPerInch = 96
18+
TextHeight = 13
19+
object Label1: TLabel
20+
Left = 0
21+
Top = 0
22+
Width = 127
23+
Height = 129
24+
Align = alClient
25+
Alignment = taCenter
26+
Caption = 'Keyboard is locked...'
27+
Color = clBlack
28+
Font.Charset = DEFAULT_CHARSET
29+
Font.Color = 5263440
30+
Font.Height = -16
31+
Font.Name = 'MS Sans Serif'
32+
Font.Style = [fsBold]
33+
ParentColor = False
34+
ParentFont = False
35+
Layout = tlCenter
36+
WordWrap = True
37+
end
38+
end

MainUnit.pas

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
unit MainUnit;
2+
3+
interface
4+
5+
uses
6+
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
7+
Dialogs, StdCtrls;
8+
9+
type
10+
TMainForm = class(TForm)
11+
Label1: TLabel;
12+
procedure FormClose(Sender: TObject; var Action: TCloseAction);
13+
procedure FormCreate(Sender: TObject);
14+
private
15+
{ Private declarations }
16+
public
17+
{ Public declarations }
18+
end;
19+
20+
{ KBDLLHOOKSTRUCT = packed record
21+
vkCode: DWORD;
22+
scanCode: DWORD;
23+
flags: DWORD;
24+
time: DWORD ;
25+
dwExtraInfo: Pointer;
26+
end;
27+
}
28+
var
29+
MainForm: TMainForm;
30+
31+
implementation
32+
const
33+
WH_KEYBOARD_LL = 13;
34+
var
35+
SysHook : HHook = 0;
36+
Wnd : Hwnd = 0;
37+
38+
function SysMsgProc(code : integer; wParam : word; lParam : longint) : longint; stdcall;
39+
begin
40+
if code < 0 then
41+
Result := CallNextHookEx(SysHook, Code, wParam, lParam)
42+
else
43+
Result:=1;
44+
end;
45+
46+
procedure Hook(switch : Boolean) export; stdcall;
47+
begin
48+
if switch=true then begin
49+
SysHook := SetWindowsHookEx(WH_KEYBOARD_LL, @SysMsgProc, HInstance, 0);
50+
end
51+
else begin
52+
UnhookWindowsHookEx(SysHook);
53+
SysHook := 0;
54+
end;
55+
end;
56+
57+
{$R *.dfm}
58+
59+
procedure TMainForm.FormCreate(Sender: TObject);
60+
begin
61+
Hook(True);
62+
end;
63+
64+
procedure TMainForm.FormClose(Sender: TObject; var Action: TCloseAction);
65+
begin
66+
Hook(False);
67+
end;
68+
69+
end.
70+

0 commit comments

Comments
 (0)