@@ -86,6 +86,8 @@ Public Class BootForm
8686 Public UnSaveData As Integer
8787 Public DisbFuState As Integer
8888 Public ShowModeTips As Integer
89+ Public NeedStillTopMost As Integer '是否强制顶置
90+ 'Public StartStillTopMost As Integer
8991
9092 Public CurCommand() As String
9193 Public ToolMode As Integer
@@ -98,12 +100,25 @@ Public Class BootForm
98100 Form2.ComboBox2.Enabled = False
99101 End Sub
100102
101- Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
102- Form1.Show()
103+ Private Sub Button1_Click( ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
104+ NeedStillTopMost = 0
105+ Form1.ShowDialog()
106+ NeedStillTopMost = 1
103107 End Sub
104108
105109 Private Sub BootForm_Load( ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase .Load
110+ 'StartStillTopMost = 0
106111 CurCommand = Split(Command.ToLower, " " )
112+
113+ ToolMode = 0
114+ NeedStillTopMost = 0
115+ For i = 0 To CurCommand.Count - 1
116+ If CurCommand(i).ToLower = "/topbar" Or CurCommand(i).ToLower = "/bottombar" Or CurCommand(i).ToLower = "/lefttopbar" Or CurCommand(i).ToLower = "/righttopbar" Or CurCommand(i).ToLower = "/leftbottombar" Or CurCommand(i).ToLower = "/rightbottombar" Or CurCommand(i).ToLower = "/leftbar" Or CurCommand(i).ToLower = "/rightbar" Then
117+ ToolMode = 1
118+ NeedStillTopMost = 1
119+ End If
120+ Next
121+
107122 '////////////////////////////////////////////////////////////////////////////////////
108123 '//
109124 '// 禁用功能策略注册表读取
@@ -679,13 +694,6 @@ Public Class BootForm
679694 'Me.Height = 39
680695 'Me.Width = 184
681696
682- ToolMode = 0
683- For i = 0 To CurCommand.Count - 1
684- If CurCommand(i).ToLower = "/topbar" Or CurCommand(i).ToLower = "/bottombar" Or CurCommand(i).ToLower = "/lefttopbar" Or CurCommand(i).ToLower = "/righttopbar" Or CurCommand(i).ToLower = "/leftbottombar" Or CurCommand(i).ToLower = "/rightbottombar" Or CurCommand(i).ToLower = "/leftbar" Or CurCommand(i).ToLower = "/rightbar" Then
685- ToolMode = 1
686- End If
687- Next
688-
689697 If Command() <> "" Then
690698 For i = 0 To CurCommand.Count - 1
691699 If CurCommand(i).ToLower = "/topbar" Or CurCommand(i).ToLower = "/bottombar" Or CurCommand(i).ToLower = "/lefttopbar" Or CurCommand(i).ToLower = "/righttopbar" Or CurCommand(i).ToLower = "/leftbottombar" Or CurCommand(i).ToLower = "/rightbottombar" Then
@@ -778,6 +786,8 @@ Public Class BootForm
778786 Dim SysDpiX As Single = Me .CreateGraphics().DpiX / 96
779787 Dim SysDpiY As Single = Me .CreateGraphics().DpiY / 96
780788 Me .Location = New Point(-( Me .Width + 5 * SysDpiX), -( Me .Height + 5 * SysDpiY))
789+ a = Me .Location
790+ NeedStillTopMost = 0
781791 Form1.Show()
782792 End If
783793 Next
@@ -819,20 +829,26 @@ Public Class BootForm
819829 Me .Location = a
820830 End If
821831 End If
822- 'If Me.TopMost = True Then
823- ' If Me.Visible = True Then
824- ' SetWindowPos(Me.Handle, HWND_TOPMOST, 0, 0, 0, 0, TOPMOST_FLAGS)
825- ' End If
832+ If Me .TopMost = True Then
833+ If Me .Visible = True Then
834+ If NeedStillTopMost = 1 Then
835+ SetWindowPos( Me .Handle, HWND_TOPMOST, 0 , 0 , 0 , 0 , TOPMOST_FLAGS)
836+ End If
837+ End If
838+ End If
839+ 'If StartStillTopMost = 1 Then
840+ ' StartStillTopMost = 0
841+ ' NeedStillTopMost = 1
826842 'End If
827843 End Sub
828- ' <DllImport("user32.dll")>
829- ' Private Shared Function SetWindowPos(ByVal hWnd As IntPtr, ByVal hWndInsertAfter As IntPtr, ByVal X As Integer, ByVal Y As Integer, ByVal cx As Integer, ByVal cy As Integer, ByVal uFlags As UInteger) As Boolean
830- ' End Function
844+ <DllImport( "user32.dll" )>
845+ Private Shared Function SetWindowPos( ByVal hWnd As IntPtr, ByVal hWndInsertAfter As IntPtr, ByVal X As Integer , ByVal Y As Integer , ByVal cx As Integer , ByVal cy As Integer , ByVal uFlags As UInteger) As Boolean
846+ End Function
831847
832- ' Const HWND_TOPMOST = -1
833- ' Const SWP_NOSIZE As UInteger = &H1
834- ' Const SWP_NOMOVE As UInteger = &H2
835- ' Const TOPMOST_FLAGS As UInteger = SWP_NOMOVE Or SWP_NOSIZE
848+ Const HWND_TOPMOST = - 1
849+ Const SWP_NOSIZE As UInteger = &H1
850+ Const SWP_NOMOVE As UInteger = &H2
851+ Const TOPMOST_FLAGS As UInteger = SWP_NOMOVE Or SWP_NOSIZE
836852 'API移动窗体
837853 Declare Function SendMessage Lib "user32" Alias "SendMessageA" ( ByVal hwnd As IntPtr, ByVal wMsg As Integer , ByVal wParam As Integer , ByVal lParam As Integer ) As Boolean
838854 Declare Function ReleaseCapture Lib "user32" Alias "ReleaseCapture" () As Boolean
@@ -896,6 +912,7 @@ Public Class BootForm
896912
897913 Private Sub Timer2_Tick( ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
898914 Me .Show()
915+ Timer1.Enabled = True
899916 Timer2.Enabled = False
900917 NotifyIcon1.Visible = False
901918 End Sub
@@ -904,7 +921,14 @@ Public Class BootForm
904921 'If MessageBox.Show("确定要关闭时钟吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) = MsgBoxResult.Yes Then
905922 'End
906923 'End If
924+ 'If CurCommand(i).ToLower = "/topbar" Or CurCommand(i).ToLower = "/bottombar" Or CurCommand(i).ToLower = "/lefttopbar" Or CurCommand(i).ToLower = "/righttopbar" Or CurCommand(i).ToLower = "/leftbottombar" Or CurCommand(i).ToLower = "/rightbottombar" Or CurCommand(i).ToLower = "/leftbar" Or CurCommand(i).ToLower = "/rightbar" Then
925+ If ToolMode = 1 Then
926+ NeedStillTopMost = 0
927+ End If
907928 Form2.ShowDialog()
929+ If ToolMode = 1 Then
930+ NeedStillTopMost = 1
931+ End If
908932 End Sub
909933
910934 Private Sub Me_FormClosing( ByVal sender As Object , ByVal e As FormClosingEventArgs) Handles Me .FormClosing
0 commit comments