Skip to content

Commit e127406

Browse files
committed
Added DisplayControl tool
1 parent d8779b3 commit e127406

7 files changed

Lines changed: 241 additions & 0 deletions

File tree

DisplayControl/DisplayControl.cfg

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
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+
-$YD
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:\programs\borland\delphi7\Projects\Bpl"
35+
-LN"c:\programs\borland\delphi7\Projects\Bpl"
36+
-w-UNSAFE_TYPE
37+
-w-UNSAFE_CODE
38+
-w-UNSAFE_CAST

DisplayControl/DisplayControl.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=1
7+
D=1
8+
E=0
9+
F=0
10+
G=1
11+
H=1
12+
I=1
13+
J=0
14+
K=0
15+
L=1
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=1
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=0
80+
UnsafeCode=0
81+
UnsafeCast=0
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=
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=
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=

DisplayControl/DisplayControl.dpr

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
program DisplayControl;
2+
3+
{$APPTYPE CONSOLE}
4+
{$R *.res}
5+
6+
uses
7+
Windows, SysUtils, Registry;
8+
9+
const
10+
EDD_GET_DEVICE_INTERFACE_NAME = 1;
11+
ENUM_REGISTRY_SETTINGS = DWORD(-2);
12+
13+
procedure ScreenEnable(dwIndex: integer);
14+
var
15+
Display: TDisplayDevice;
16+
DevMode: TDevMode;
17+
begin
18+
Display.cb:=SizeOf(TDisplayDevice);
19+
EnumDisplayDevices(nil, dwIndex, Display, EDD_GET_DEVICE_INTERFACE_NAME);
20+
EnumDisplaySettings(PChar(@Display.DeviceName[0]), ENUM_REGISTRY_SETTINGS, DevMode);
21+
DevMode.dmFields:=DM_BITSPERPEL or DM_PELSWIDTH or DM_PELSHEIGHT or DM_DISPLAYFREQUENCY or DM_DISPLAYFLAGS or DM_POSITION;
22+
if (Display.StateFlags and DISPLAY_DEVICE_PRIMARY_DEVICE) <> DISPLAY_DEVICE_PRIMARY_DEVICE then begin
23+
ChangeDisplaySettingsEx(PChar(@Display.DeviceName[0]), DevMode, 0, CDS_UPDATEREGISTRY or CDS_NORESET, nil);
24+
ChangeDisplaySettingsEx(nil, PDevMode(nil)^, 0, 0, nil);
25+
end;
26+
end;
27+
28+
procedure ScreenDisable(dwIndex: integer);
29+
var
30+
Display: TDisplayDevice;
31+
DevMode: TDevMode;
32+
begin
33+
Display.cb:=SizeOf(TDisplayDevice);
34+
EnumDisplayDevices(nil, dwIndex, Display, EDD_GET_DEVICE_INTERFACE_NAME);
35+
ZeroMemory(@DevMode, SizeOf(TDevMode));
36+
DevMode.dmSize:=SizeOf(TDevMode);
37+
DevMode.dmBitsPerPel:=32;
38+
DevMode.dmFields:=DM_BITSPERPEL or DM_PELSWIDTH or DM_PELSHEIGHT or DM_DISPLAYFREQUENCY or DM_DISPLAYFLAGS or DM_POSITION;
39+
if (Display.StateFlags and DISPLAY_DEVICE_PRIMARY_DEVICE) <> DISPLAY_DEVICE_PRIMARY_DEVICE then begin
40+
ChangeDisplaySettingsEx(PChar(@Display.DeviceName[0]), DevMode, 0, CDS_UPDATEREGISTRY or CDS_NORESET, nil);
41+
ChangeDisplaySettingsEx(nil, PDevMode(nil)^, 0, 0, nil);
42+
end;
43+
end;
44+
45+
var
46+
Reg: TRegistry;
47+
begin
48+
Reg:=TRegistry.Create;
49+
Reg.RootKey:=HKEY_CURRENT_USER;
50+
if Reg.OpenKey('\Software\TrueOpenVR', false) = true then begin
51+
if AnsiLowerCase(ParamStr(1)) = '/on' then ScreenEnable(Reg.ReadInteger('ScreenIndex') - 1);
52+
if AnsiLowerCase(ParamStr(1)) = '/off' then ScreenDisable(Reg.ReadInteger('ScreenIndex') - 1);
53+
end;
54+
Reg.CloseKey;
55+
Reg.Free;
56+
end.

DisplayControl/DisplayControl.res

31.5 KB
Binary file not shown.

DisplayControl/Off.bat

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
DisplayControl.exe /off

DisplayControl/On.bat

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
DisplayControl.exe /on

DisplayControl/clear.bat

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
del *.obj
2+
del *.dcu
3+
del *.~*
4+
del *.hpp
5+
del *.dcp
6+
del *.dpl
7+
del *.cesettings
8+
del *.bak
9+
--del *.exe*

0 commit comments

Comments
 (0)