Skip to content

Commit 5f271ec

Browse files
committed
修改策略、修复Bugs - 20241004
1 parent 5d1e1c3 commit 5f271ec

File tree

15 files changed

+86
-71
lines changed

15 files changed

+86
-71
lines changed

Assets/SettingUI.png

-590 Bytes
Loading

Src/PackOut.bat

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ md "%~dp0TimeControl-Bin"
66
copy "%~dp0TimeControl\files\1-安装.bat" "%~dp0TimeControl-Bin\1-安装.bat"
77
copy "%~dp0TimeControl\files\2-卸载.bat" "%~dp0TimeControl-Bin\2-卸载.bat"
88
copy "%~dp0TimeControl\files\TimeControlAdmxs.exe" "%~dp0TimeControl-Bin\TimeControlAdmxs.exe"
9+
copy "%~dp0TimeControl\files\TimeControl.adm" "%~dp0TimeControl-Bin\TimeControl.adm"
910
copy "%~dp0TimeControl\files\UserinitBootInstall.bat" "%~dp0TimeControl-Bin\UserinitBootInstall.bat"
1011
copy "%~dp0TimeControl\files\UserinitBootUnInstall.bat" "%~dp0TimeControl-Bin\UserinitBootUnInstall.bat"
1112
copy "%~dp0TimeControl\bin\Release\TimeControl.exe" "%~dp0TimeControl-Bin\TimeControl.exe"

Src/TimeControl.suo

3.5 KB
Binary file not shown.

Src/TimeControl/Form1.vb

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ Public Class Form1
381381
Dim unloadfut As Integer = 0
382382
Try
383383

384-
Dim plkeycr As RegistryKey = Registry.CurrentUser.OpenSubKey("SOFTWARE\CJH\Policies\TimeControl", True)
384+
Dim plkeycr As RegistryKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\Policies\CJH\TimeControl", True)
385385

386386
Dim disfucrt As Integer = -1
387387
If (Not plkeycr Is Nothing) Then
@@ -450,7 +450,7 @@ Public Class Form1
450450
End Try
451451

452452
Try
453-
Dim plkey As RegistryKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\CJH\Policies\TimeControl", True)
453+
Dim plkey As RegistryKey = Registry.CurrentUser.OpenSubKey("SOFTWARE\Policies\CJH\TimeControl", True)
454454
Dim disfu As Integer
455455

456456
If cdisbfut = 0 Then
@@ -707,22 +707,14 @@ Public Class Form1
707707
If (Not mykey Is Nothing) Then
708708
Me.UseMoveV = mykey.GetValue("EnableDrag", -1)
709709
If Me.UseMoveV = -1 Then
710-
711710
RegKeyModule.AddReg("Software\CJH\TimeControl\Settings", "EnableDrag", 1, RegistryValueKind.DWord, "HKCU")
712-
713-
714711
Me.UseMoveV = 1
715712
ElseIf Me.UseMoveV > 1 Then
716-
717713
RegKeyModule.AddReg("Software\CJH\TimeControl\Settings", "EnableDrag", 1, RegistryValueKind.DWord, "HKCU")
718-
719714
Me.UseMoveV = 1
720715
End If
721716
Else
722-
723717
RegKeyModule.AddReg("Software\CJH\TimeControl\Settings", "EnableDrag", 1, RegistryValueKind.DWord, "HKCU")
724-
725-
726718
Me.UseMoveV = 1
727719
End If
728720

@@ -795,6 +787,9 @@ Public Class Form1
795787
Me.TopMost = False
796788
ElseIf UseTop = 1 Then
797789
Me.TopMost = True
790+
ElseIf UseTop > 1 Then
791+
RegKeyModule.AddReg("Software\CJH\TimeControl\Settings", "AllowTopMost", 1, RegistryValueKind.DWord, "HKCU")
792+
Me.TopMost = True
798793
End If
799794
Else
800795
RegKeyModule.AddReg("Software\CJH\TimeControl\Settings", "AllowTopMost", 1, RegistryValueKind.DWord, "HKCU")
@@ -1313,7 +1308,7 @@ Public Class Form1
13131308
RegKeyModule.AddReg("Software\CJH\TimeControl\Settings", "TimeFontG", Label1.ForeColor.G, RegistryValueKind.DWord, "HKCU")
13141309
RegKeyModule.AddReg("Software\CJH\TimeControl\Settings", "TimeFontB", Label1.ForeColor.B, RegistryValueKind.DWord, "HKCU")
13151310
End If
1316-
1311+
Form2.ColorDialog1.Color = Color.White
13171312
End If
13181313
Me.ContextMenuStrip1.BackColor = Color.FromArgb(32, 32, 32)
13191314
Me.ContextMenuStrip1.ForeColor = Color.White
@@ -1363,6 +1358,7 @@ Public Class Form1
13631358
RegKeyModule.AddReg("Software\CJH\TimeControl\Settings", "TimeFontG", Label1.ForeColor.G, RegistryValueKind.DWord, "HKCU")
13641359
RegKeyModule.AddReg("Software\CJH\TimeControl\Settings", "TimeFontB", Label1.ForeColor.B, RegistryValueKind.DWord, "HKCU")
13651360
End If
1361+
Form2.ColorDialog1.Color = Color.Black
13661362
End If
13671363
Me.ContextMenuStrip1.BackColor = Color.White
13681364
Me.ContextMenuStrip1.ForeColor = Color.Black

Src/TimeControl/Form2.Designer.vb

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Src/TimeControl/Form2.resx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@
127127
<data name="PictureBox1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
128128
<value>
129129
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAIGNIUk0AAHolAACAgwAA+f8AAIDpAAB1
130-
MAAA6mAAADqYAAAXb5JfxUYAAAAJcEhZcwAADsIAAA7CARUoSoAAAAB7SURBVDhPxZHRCYAwDAU7jiM4
130+
MAAA6mAAADqYAAAXb5JfxUYAAAAJcEhZcwAADsEAAA7BAbiRa+0AAAB7SURBVDhPxZHRCYAwDAU7jiM4
131131
mFO4kXM4UPQhD8xL0ip+WDiwIXcUbGYWmJbNMnQPhAEW53VPySJO7MmEe2lAl3l0HgKVnH0TRoZyNXsV
132132
0DuBmwaUT4FKBv8G4J2n/o0jXKAXwdEZZeACT17CvRAgVUhF4i53KFTihbUD0860AyUhweoAAAAASUVO
133133
RK5CYII=
@@ -139,7 +139,7 @@
139139
<data name="PictureBox2.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
140140
<value>
141141
iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAIGNIUk0AAHolAACAgwAA+f8AAIDpAAB1
142-
MAAA6mAAADqYAAAXb5JfxUYAAAAJcEhZcwAACxEAAAsRAX9kX5EAAAzwSURBVHhe1ZvZdhXVFobzCL6B
142+
MAAA6mAAADqYAAAXb5JfxUYAAAAJcEhZcwAACxAAAAsQAa0jvXUAAAzwSURBVHhe1ZvZdhXVFobzCL6B
143143
vMnhDQ5vcHLlpeFOuUruvIQ77DAqYIcYbLAZQ40iDFCUOGyGDcIWxF6zsW9ZdeY3mf9y1tq1Q5CAWGN8
144144
Y85VCcn+5lxVtapSzFztbWlpaZMx+8QTT2w3lh5//PEVY2R0RonYHThwYGSsGPbtSwv2vf/l38aP+Xdt
145145
9uH/gzCiFl1QMUDcMeE6JgcTr9h4ZHHR2Bw//vrc7APe8OSTT86byNhka2czEsy5CNmaNxTiY489Ntq/

Src/TimeControl/Form2.vb

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ errcode:
142142
TextBox4.Enabled = True
143143
Button9.Enabled = True
144144
End If
145-
145+
146146
Else
147147
Me.CheckBox4.Checked = False
148148
If Form1.DisbFuState = 0 Then
@@ -208,7 +208,7 @@ errcode:
208208
ComboBox4.SelectedText = "自定义背景"
209209
End If
210210

211-
Label1.Text = "时间小工具 版本:" & My.Application.Info.Version.ToString & vbCrLf & "版权所有 © 2022-2024 CJH。"
211+
Label1.Text = "时钟小工具 版本:" & My.Application.Info.Version.ToString & vbCrLf & "版权所有 © 2022-2024 CJH。"
212212
Call formatcolorcurset()
213213
End Sub
214214
Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
@@ -537,7 +537,7 @@ errcode:
537537
'ElseIf disi.DpiY > 160 Then
538538
' Form1.SetTimeFormSize(aa.Height - 30 * disi.DpiY * 0.01, aa.Width - 120 - 800 * disi.DpiY * 0.01)
539539
'End If
540-
540+
541541
'If disi.DpiY < 100 Then
542542
' If aa.Width <= 42 Then
543543
' Form1.SetTimeFormSize(Form1.Label1.Font.Size * disi.DpiY * 0.01 + disi.DpiY * 0.01 * 20, aa.Width + 8)
@@ -871,7 +871,7 @@ errcode:
871871
TextBox2.Enabled = False
872872
Button4.Enabled = False
873873
End If
874-
874+
875875
'Form1.GetTimeFormSize(38, 300)
876876
'a = Form1.Width - Form1.CaW
877877
'If a <> 0 Then
@@ -984,7 +984,7 @@ errcode:
984984
c = 0
985985
Form1.SetTimeFormSize(a.Height + 3, a.Width + 3)
986986
End If
987-
987+
988988
'Form1.Label1.AutoSize = False
989989
If Form1.UnSaveData = 0 Then
990990
RegKeyModule.AddReg("Software\CJH\TimeControl\Settings", "CustomFormat", TextBox2.Text, RegistryValueKind.String, "HKCU")
@@ -1004,7 +1004,7 @@ errcode:
10041004
'RemoveHandler CheckBox3.CheckedChanged, AddressOf CheckBox3_CheckedChanged
10051005
'RemoveHandler CheckBox4.CheckedChanged, AddressOf CheckBox4_CheckedChanged
10061006
Try
1007-
AddReg("Software\CJH\TimeControl\Settings", "ColorMode", 0, Microsoft.Win32.RegistryValueKind.DWord, "HKCU")
1007+
AddReg("Software\CJH\TimeControl\Settings", "ColorMode", 0, Microsoft.Win32.RegistryValueKind.DWord, "HKCU")
10081008

10091009

10101010
If Form1.UnSupportDarkSys = 1 Then
@@ -1133,30 +1133,30 @@ errcode:
11331133
Form1.Location = New Size((System.Windows.Forms.SystemInformation.PrimaryMonitorSize.Width - Form1.Width) / 2, 5)
11341134

11351135

1136-
RegKeyModule.AddReg("Software\CJH\TimeControl\Settings", "TimeFormOpacity", 100, RegistryValueKind.DWord, "HKCU")
1136+
RegKeyModule.AddReg("Software\CJH\TimeControl\Settings", "TimeFormOpacity", 100, RegistryValueKind.DWord, "HKCU")
11371137

11381138

1139-
Form1.CustOpacity = 100
1140-
Label17.Text = "99%"
1141-
Form1.Opacity = 0.99
1142-
TrackBar1.Value = 99
1139+
Form1.CustOpacity = 100
1140+
Label17.Text = "99%"
1141+
Form1.Opacity = 0.99
1142+
TrackBar1.Value = 99
11431143

1144-
CheckBox5.Checked = False
1144+
CheckBox5.Checked = False
11451145

1146-
Call Form1.formatcolorcur()
1147-
Call formatcolorcurset()
1148-
Call MsgForm.formatcolorcursetmsg()
1149-
Call GPLForm.formatcolorcursetmsg()
1146+
Call Form1.formatcolorcur()
1147+
Call formatcolorcurset()
1148+
Call MsgForm.formatcolorcursetmsg()
1149+
Call GPLForm.formatcolorcursetmsg()
11501150

11511151

1152-
'如果预先关联事件, Me.CheckBox1.Checked = Ture / Flase 操作会触发事件,导致操作相反
1153-
'AddHandler CheckBox1.CheckedChanged, AddressOf CheckBox1_CheckedChanged
1154-
'AddHandler CheckBox2.CheckedChanged, AddressOf CheckBox2_CheckedChanged
1155-
'AddHandler CheckBox3.CheckedChanged, AddressOf CheckBox3_CheckedChanged
1156-
'AddHandler CheckBox4.CheckedChanged, AddressOf CheckBox4_CheckedChanged
1152+
'如果预先关联事件, Me.CheckBox1.Checked = Ture / Flase 操作会触发事件,导致操作相反
1153+
'AddHandler CheckBox1.CheckedChanged, AddressOf CheckBox1_CheckedChanged
1154+
'AddHandler CheckBox2.CheckedChanged, AddressOf CheckBox2_CheckedChanged
1155+
'AddHandler CheckBox3.CheckedChanged, AddressOf CheckBox3_CheckedChanged
1156+
'AddHandler CheckBox4.CheckedChanged, AddressOf CheckBox4_CheckedChanged
11571157
Catch ex As Exception
1158-
MsgBox("恢复默认设置失败。" & vbCrLf & ex.Message, MsgBoxStyle.Critical, "错误")
1159-
End Try
1158+
MsgBox("恢复默认设置失败。" & vbCrLf & ex.Message, MsgBoxStyle.Critical, "错误")
1159+
End Try
11601160
End If
11611161
End Sub
11621162

@@ -1613,35 +1613,35 @@ errcode:
16131613
End If
16141614
End If
16151615
Else
1616-
If Form1.MySize = 0 Then
1616+
If Form1.MySize = 0 Then
16171617
Form1.Label1.Text = Format(Now(), Form1.TimeF)
16181618
Form1.Timer1.Interval = 1000
1619-
Dim aa As SizeF
1620-
Dim b As Graphics = Graphics.FromImage(New Bitmap(1, 1))
1619+
Dim aa As SizeF
1620+
Dim b As Graphics = Graphics.FromImage(New Bitmap(1, 1))
16211621
aa = TextRenderer.MeasureText(Form1.Label1.Text, Form1.Label1.Font)
1622-
Dim c As Integer
1623-
If aa.Width <= 42 Then
1624-
Form1.GetTimeFormSize(38, aa.Width + 8)
1625-
ElseIf 400 <= aa.Width Then
1622+
Dim c As Integer
1623+
If aa.Width <= 42 Then
1624+
Form1.GetTimeFormSize(38, aa.Width + 8)
1625+
ElseIf 400 <= aa.Width Then
16261626
Form1.GetTimeFormSize(aa.Height, aa.Width + 10)
1627-
Else
1628-
Form1.GetTimeFormSize(38, aa.Width + 6)
1629-
End If
1630-
c = Form1.Width - Form1.CaW
1631-
If c <> 0 Then
1632-
Form1.Location = New Point(Form1.Location.X + c / 2, Form1.Location.Y)
1627+
Else
1628+
Form1.GetTimeFormSize(38, aa.Width + 6)
1629+
End If
1630+
c = Form1.Width - Form1.CaW
1631+
If c <> 0 Then
1632+
Form1.Location = New Point(Form1.Location.X + c / 2, Form1.Location.Y)
16331633
If Form1.SaveLoc = 1 Then
16341634
If Form1.UnSaveData = 0 Then
16351635
RegKeyModule.AddReg("Software\CJH\TimeControl\Settings", "TimeFormX", Form1.Location.X, RegistryValueKind.DWord, "HKCU")
16361636
RegKeyModule.AddReg("Software\CJH\TimeControl\Settings", "TimeFormY", Form1.Location.Y, RegistryValueKind.DWord, "HKCU")
16371637
End If
16381638

16391639
End If
1640-
End If
1641-
c = 0
1642-
Form1.SetTimeFormSize(aa.Height, aa.Width)
16431640
End If
1641+
c = 0
1642+
Form1.SetTimeFormSize(aa.Height, aa.Width)
16441643
End If
1644+
End If
16451645
End Sub
16461646

16471647
Private Sub LinkLabel3_LinkClicked(sender As System.Object, e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel3.LinkClicked
@@ -1658,7 +1658,7 @@ errcode:
16581658
End Sub
16591659

16601660
Private Sub LinkLabel5_LinkClicked(sender As System.Object, e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel5.LinkClicked
1661-
MessageBox.Show("当前支持的命令行:" & vbCrLf & "/safemode 以安全模式加载,不读取设置也不保存设置。当程序由于配置原因无法正常启动,可以使用该命令行启动后恢复默认设置。" & vbCrLf & "/noproflie 不使用配置文件。" & vbCrLf & "/nosaveprofile 读取设置但不保存设置" & vbCrLf & vbCrLf & "部分功能可能因为策略设置而不可用。命令行的内容要优先于策略设置,为单一用户设置的策略优先级高于针对所有用户设置的策略(需要以管理员身份启动本程序以应用针对所有用户设置的策略)。", "帮助", MessageBoxButtons.YesNo, MessageBoxIcon.Information)
1661+
MessageBox.Show("当前支持的命令行:" & vbCrLf & "/safemode 以安全模式加载,不读取设置也不保存设置。当程序由于配置原因无法正常启动,可以使用该命令行启动后恢复默认设置。" & vbCrLf & "/noproflie 不使用配置文件。" & vbCrLf & "/nosaveprofile 读取设置但不保存设置" & vbCrLf & vbCrLf & "部分功能可能因为策略设置而不可用。命令行的内容要优先于策略设置,为所有用户设置的策略优先级高于针对单一用户设置的策略。", "帮助", MessageBoxButtons.OK, MessageBoxIcon.Information)
16621662
End Sub
16631663

16641664
Private Sub Button12_Click(sender As System.Object, e As System.EventArgs) Handles Button12.Click

Src/TimeControl/My Project/AssemblyInfo.vb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
3131
' 方法是按如下所示使用“*”:
3232
' <Assembly: AssemblyVersion("1.0.*")>
3333

34-
<Assembly: AssemblyVersion("1.1.17.24091")>
35-
<Assembly: AssemblyFileVersion("1.1.17.24091")>
34+
<Assembly: AssemblyVersion("1.1.18.24101")>
35+
<Assembly: AssemblyFileVersion("1.1.18.24101")>

Src/TimeControl/files/1-安装.bat

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,10 +152,12 @@ if "%ab%" == "1" echo.
152152
if "%ab%" == "1" call "%~dp0UserinitBootUnInstall.bat" "%programfiles%\CJH\TimeControl\TimeControl.exe"
153153
if "%ab%" == "1" call "%~dp0UserinitBootInstall.bat" "%programfiles%\CJH\TimeControl\TimeControl.exe"
154154
echo.
155-
choice /C YN /T 5 /D Y /M "是(Y)否(N)要安装策略到当前系统(安装后可以使用组策略编辑时钟小工具的策略)(仅Windows Vista以上版本支持)(5秒后自动选择Y)"
155+
choice /C YN /T 5 /D Y /M "是(Y)否(N)要安装策略到当前系统(安装后可以使用组策略编辑时钟小工具的策略)(5秒后自动选择Y)"
156156
if errorlevel 1 set ac=1
157157
if errorlevel 2 set ac=2
158158
if "%ac%" == "1" if exist "%windir%\PolicyDefinitions\*.admx" call "%~dp0TimeControlAdmxs.exe"
159+
if "%ac%" == "1" if exist "%windir%\inf\*.adm" copy "%~dp0TimeControl.adm" "%windir%\inf\TimeControl.adm" /y
160+
::if "%ac%" == "1" if exist "%windir%\inf\*.adm" Reg add "HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\Group Policy" /v OnlyUseLocalAdminFiles /t REG_DWORD /d 1 /f
159161

160162
echo.
161163
choice /C YN /T 5 /D Y /M "是(Y)否(N)要创建快捷方式到开始菜单(5秒后自动选择Y)"
@@ -187,6 +189,8 @@ echo ====================================================
187189
echo 时钟小工具安装程序
188190
echo ====================================================
189191
echo.
192+
if "%ac%" == "1" if exist "%windir%\inf\*.adm" echo Windows XP 系统请手动在gpedit.msc(组策略)里的计算机管理-管理模板右键里的添加/删除模板里手动添加 %windir%\inf\TimeControl.adm 策略文件。
193+
if "%ac%" == "1" if exist "%windir%\inf\*.adm" echo.
190194
echo 安装完成!任意键退出... & pause > nul
191195
goto enda
192196

@@ -244,10 +248,12 @@ if "%ab%" == "1" echo.
244248
if "%ab%" == "1" call "%~dp0UserinitBootUnInstall.bat" "%programfiles%\CJH\TimeControl\TimeControl.exe"
245249
if "%ab%" == "1" call "%~dp0UserinitBootInstall.bat" "%programfiles%\CJH\TimeControl\TimeControl.exe"
246250
echo.
247-
choice /C YN /T 5 /D Y /M "是(Y)否(N)要安装策略到当前系统(安装后可以使用组策略编辑时钟小工具的策略)(仅Windows Vista以上版本支持)(5秒后自动选择Y)"
251+
choice /C YN /T 5 /D Y /M "是(Y)否(N)要安装策略到当前系统(安装后可以使用组策略编辑时钟小工具的策略)(5秒后自动选择Y)"
248252
if errorlevel 1 set ac=1
249253
if errorlevel 2 set ac=2
250254
if "%ac%" == "1" if exist "%windir%\PolicyDefinitions\*.admx" call "%~dp0TimeControlAdmxs.exe"
255+
if "%ac%" == "1" if exist "%windir%\inf\*.adm" copy "%~dp0TimeControl.adm" "%windir%\inf\TimeControl.adm" /y
256+
::if "%ac%" == "1" if exist "%windir%\inf\*.adm" Reg add "HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\Group Policy" /v OnlyUseLocalAdminFiles /t REG_DWORD /d 1 /f
251257

252258
echo.
253259
choice /C YN /T 5 /D Y /M "是(Y)否(N)要创建快捷方式到开始菜单(5秒后自动选择Y)"
@@ -281,6 +287,8 @@ echo ====================================================
281287
echo 时钟小工具安装程序
282288
echo ====================================================
283289
echo.
290+
if "%ac%" == "1" if exist "%windir%\inf\*.adm" echo Windows XP 系统请手动在gpedit.msc(组策略)里的计算机管理-管理模板右键里的添加/删除模板里手动添加 %windir%\inf\TimeControl.adm 策略文件。
291+
if "%ac%" == "1" if exist "%windir%\inf\*.adm" echo.
284292
echo 安装完成!任意键退出... & pause > nul
285293
goto enda
286294

0 commit comments

Comments
 (0)