-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfrmTray.frm
executable file
·503 lines (465 loc) · 14.4 KB
/
frmTray.frm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
VERSION 5.00
Object = "{248DD890-BB45-11CF-9ABC-0080C7E7B78D}#1.0#0"; "mswinsck.ocx"
Begin VB.Form frmTray
BackColor = &H00404040&
BorderStyle = 0 'None
ClientHeight = 645
ClientLeft = 120
ClientTop = 120
ClientWidth = 2235
ControlBox = 0 'False
FillColor = &H80000012&
Icon = "frmTray.frx":0000
LinkMode = 1 'Source
LinkTopic = "LockPro"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 645
ScaleWidth = 2235
ShowInTaskbar = 0 'False
StartUpPosition = 3 '窗口缺省
Begin MSWinsockLib.Winsock sckHtp
Index = 0
Left = 2040
Top = 0
_ExtentX = 741
_ExtentY = 741
_Version = 393216
LocalPort = 80
End
Begin VB.Timer tmrCntDwn
Enabled = 0 'False
Interval = 500
Left = 0
Top = 480
End
Begin LockPro.Downloader Updater
Left = 1440
Top = 0
_ExtentX = 847
_ExtentY = 847
End
Begin VB.Timer tmrSUp
Enabled = 0 'False
Interval = 1
Left = 960
Top = 0
End
Begin VB.Timer tmrSMe
Enabled = 0 'False
Interval = 1
Left = 480
Top = 0
End
Begin VB.PictureBox picDDE
Height = 255
Left = 0
ScaleHeight = 195
ScaleWidth = 195
TabIndex = 0
Top = 0
Visible = 0 'False
Width = 255
End
Begin VB.Timer tmrKey
Interval = 50
Left = 0
Top = 0
End
Begin VB.Label lblMore
Alignment = 2 'Center
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "r"
BeginProperty Font
Name = "Webdings"
Size = 9
Charset = 2
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00C0C0C0&
Height = 285
Left = 1905
MousePointer = 14 'Arrow and Question
TabIndex = 2
ToolTipText = "忽略更新"
Top = 720
Width = 225
End
Begin VB.Label lblUpd
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "发现新版本了哦~"
BeginProperty Font
Name = "微软雅黑"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00C0C0C0&
Height = 255
Left = 165
MousePointer = 14 'Arrow and Question
TabIndex = 1
ToolTipText = "点击查看更新"
Top = 720
Width = 1395
End
Begin LockPro.PngImage pngMenu
Height = 645
Left = 1800
ToolTipText = "菜单"
Top = 0
Width = 435
_ExtentX = 767
_ExtentY = 1138
Image = "frmTray.frx":4781A
OLEdrop = 1
Props = 5
End
Begin LockPro.PngImage pngLock
Height = 645
Left = 0
ToolTipText = "双击立即锁定计算机"
Top = 0
Width = 1800
_ExtentX = 3175
_ExtentY = 1138
Image = "frmTray.frx":47CC9
OLEdrop = 1
Props = 5
End
Begin VB.Menu mnuMain
Caption = "Menu"
Visible = 0 'False
Begin VB.Menu mnuLock
Caption = "立即锁定计算机"
End
Begin VB.Menu mnuLine1
Caption = "-"
End
Begin VB.Menu mnuGuide
Caption = "打开使用向导"
End
Begin VB.Menu mnuTimer
Caption = "定时器"
End
Begin VB.Menu mnuSet
Caption = "Lock Pro 设置"
End
Begin VB.Menu mnuLine2
Caption = "-"
End
Begin VB.Menu mnuAbout
Caption = "关于 Lock Pro"
End
Begin VB.Menu mnuExit
Caption = "退出"
End
End
End
Attribute VB_Name = "frmTray"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim Shdw As cShadow
Dim lpPoint As POINTAPI
Sub CloseLP()
If ReadCon("UNR") = 1 Then RtlSetProcessIsCritical 0, 0, 0
SaveCon "FormLeft", CStr(Me.Left)
UnHook Me.hwnd
Set Shdw = Nothing
Dim frms As Form
For Each frms In VB.Forms
Unload frms
Next
End Sub
Sub SetSocket()
On Error GoTo SSErr
Dim i As Long
If ReadCon("Remolock") = "1" Then
ResetAllSocket
With sckHtp(0)
.LocalPort = CLng(ReadCon("Port"))
.Protocol = sckTCPProtocol
.Listen
End With
Else
ResetAllSocket
End If
Exit Sub
SSErr:
MsgBox "初始化 Remolock 远程服务时出现错误 " & Err.Number & "!" & vbCrLf & Err.Description, 48, "初始化 Remolock 错误"
SaveCon "Remolock", "0"
End Sub
Sub ResetAllSocket()
On Error GoTo rsErr
Dim i As Long
sckHtp(0).Close
If sckHtp.Count > 1 Then
For i = 1 To sckHtp.UBound
sckHtp(i).Close
Unload sckHtp(i)
Next i
End If
Exit Sub
rsErr:
If Err.Number = 340 Then
i = i + 1
Resume
End If
End Sub
Private Sub sckHtp_ConnectionRequest(Index As Integer, ByVal requestID As Long)
Load sckHtp(requestID)
With sckHtp(requestID)
.Tag = 0
.Accept requestID
End With
End Sub
Private Sub sckHtp_DataArrival(Index As Integer, ByVal bytesTotal As Long)
On Error Resume Next
Dim sTmp As String
sckHtp(Index).GetData sTmp, vbString
HTTPRespond sckHtp(Index), sTmp, "Remolock"
End Sub
Private Sub sckHtp_Error(Index As Integer, ByVal Number As Integer, Description As String, ByVal sCode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean)
CancelDisplay = True
End Sub
Private Sub sckHtp_SendComplete(Index As Integer)
HTTPSendCheck sckHtp(Index)
End Sub
Private Sub Form_LinkExecute(CmdStr As String, Cancel As Integer)
Select Case LCase(CmdStr)
Case "lock"
frmLock.Show
End Select
Cancel = False
End Sub
Private Sub Form_Load()
On Error Resume Next
If App.PrevInstance Then
If ReadCon("First") = 0 Then
On Error Resume Next
Dim t As Long
With picDDE
.LinkMode = 0
.LinkTopic = "LockPro|LockPro"
.LinkMode = 2
.LinkExecute "lock"
t = .LinkTimeout
.LinkTimeout = 1
.LinkMode = 0
.LinkTimeout = t
End With
On Error GoTo 0
End If
End
End If
If LCase(Command) = "lock" And ReadCon("First") = 0 Then frmLock.Show 1
If ReadCon("UNR") = 1 Then
RtlAdjustPrivilege 20, 1, 0, 0
RtlSetProcessIsCritical 0, 0, 1
End If
FormOnTop Me
If ReadCon("First") = 1 Then
Me.Move (Screen.Width - Me.Width) / 2, -20, pngMenu.Left + pngMenu.Width, pngLock.Height
Else
Me.Move CSng(ReadCon("FormLeft")), _
-20, pngMenu.Left + pngMenu.Width, pngLock.Height
End If
Set Shdw = New cShadow
With Shdw
.Transparency = 120
.Depth = 10
.Shadow Me
End With
setBorderColor Me.hwnd, RGB(0, 170, 255)
Me.Show
If ReadCon("First") = 1 Then
Me.Enabled = False
frmGuide.Show
Else
lblUpd.Move 120, pngLock.Height + 75
lblMore.Move Me.ScaleWidth - lblMore.Width - 75, pngLock.Height + (lblUpd.Height + 150 - lblMore.Height) / 2
Updater.BeginDownload "http://maxxsoft.net/Update/LockPro/update.html", MyPath & "ver.log" '检查更新
SetSocket
End If
End Sub
Private Sub lblMore_Click()
tmrSUp.Tag = ""
tmrSUp.Enabled = True
End Sub
Private Sub lblUpd_Click()
If Dir(MyPath & "update.exe") = "" Then
Shell "rundll32.exe url.dll,FileProtocolHandler http://maxxsoft.net/lockpro.html", vbNormalFocus
Else
ShellExecute 0, "open", MyPath & "update.exe", "", "", 1
End If
tmrSUp.Tag = ""
tmrSUp.Enabled = True
End Sub
Private Sub mnuAbout_Click()
frmAbout.Show 1
End Sub
Private Sub mnuExit_Click()
If ReadCon("ExitPsw") = 1 Then
frmExit.ChangeMode 0
frmExit.Show 1
Else
CloseLP
End If
End Sub
Private Sub mnuGuide_Click()
frmGuide.Show 1
End Sub
Private Sub mnuLock_Click()
On Error Resume Next
frmLock.Show
End Sub
Private Sub mnuSet_Click()
Me.Enabled = False
frmSettings.Show ' 1
End Sub
Private Sub mnuTimer_Click()
frmTimer.Show
End Sub
Private Sub pngLock_DblClick(ByVal Button As Integer)
mnuLock_Click
End Sub
Private Sub pngLock_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
pngLock.FadeInOut 80, 5
End Sub
Private Sub pngLock_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
On Error Resume Next
Static ox!
With Me
If Button = 1 Then
.Left = .Left - ox + x
.Top = -20
Else
ox = x
End If
End With
End Sub
Private Sub pngLock_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
pngLock.FadeInOut 100, 2
End Sub
Private Sub pngMenu_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
pngMenu.FadeInOut 80, 5
End Sub
Private Sub pngMenu_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
pngMenu.FadeInOut 100, 2
PopupMenu mnuMain, 0, pngMenu.Left, pngMenu.Height
End Sub
Private Sub tmrCntDwn_Timer()
lCdTime = lCdTime - 1
If lCdTime <= 0 Then
Unload frmExit
mnuLock_Click
If TimerShowed Then Unload frmTimer
tmrCntDwn.Enabled = False
End If
If TimerShowed Then
With frmTimer
.txtTime.Text = CStr(Int(lCdTime / (2 * 60)) + 1)
If .btnStop.Caption = " " Then
.btnStop.Caption = "正在计时,再次点按停止计时"
Else
.btnStop.Caption = " "
End If
End With
End If
End Sub
Private Sub tmrKey_Timer()
GetCursorPos lpPoint
If lpPoint.y < ScaleY(Me.Top + Me.Height, vbTwips, vbPixels) Then
If Me.Top < -20 Then
tmrSMe.Tag = ""
tmrSMe.Enabled = True
End If
Else
If Me.Top > -pngLock.Height + 40 Then
tmrSMe.Tag = "Up"
tmrSMe.Enabled = True
End If
End If
If GetAsyncKeyState(vbKeyControl) And GetAsyncKeyState(Asc(ReadCon("Key"))) Then
If ReadCon("First") = 0 Then frmLock.Show
End If
If Locked And GetAsyncKeyState(vbKeyControl) And GetAsyncKeyState(vbKeyDelete) Then
'Shell "shutdown.exe -s -t 0"
NtShutdown
End If
If Locked And GetAsyncKeyState(vbKeyControl) And GetAsyncKeyState(vbKeyEscape) Then
'Shell "shutdown.exe -s -t 0"
NtShutdown
End If
End Sub
Private Sub tmrSMe_Timer()
With Me
If tmrSMe.Tag = "" Then
.Top = .Top + GetMoveNum(-20, .Top, 3)
If GetMoveNum(-20, .Top, 3) = 0 Then
.Top = -20
tmrSMe.Enabled = False
End If
Else
If .Left < 0 Then .Left = .Left + GetMoveNum(0, .Left, 3)
If .Left > Screen.Width - .Width Then .Left = .Left + GetMoveNum(Screen.Width - .Width, .Left, 3)
.Top = .Top + GetMoveNum(-pngLock.Height + 40, .Top, 3)
If GetMoveNum(-pngLock.Height + 40, .Top, 3) = 0 Then
.Top = -pngLock.Height + 40
tmrSMe.Enabled = False
End If
End If
End With
End Sub
Private Sub tmrSUp_Timer()
With Me
If tmrSUp.Tag = "" Then
.Height = .Height + GetMoveNum(pngLock.Height, .Height, 3)
If GetMoveNum(pngLock.Height, .Height, 3) = 0 Then
.Height = pngLock.Height
tmrSUp.Enabled = False
End If
Else
.Height = .Height + GetMoveNum(lblUpd.Top + lblUpd.Height + 75, .Height, 3)
If GetMoveNum(lblUpd.Top + lblUpd.Height + 75, .Height, 3) = 0 Then
.Height = lblUpd.Top + lblUpd.Height + 75
tmrSUp.Enabled = False
End If
End If
End With
End Sub
Private Sub Updater_DownloadComplete(MaxBytes As Long, SaveFile As String)
On Error GoTo ChkErr
Dim sTmp As String, sVer As String, sVers() As String, nVer As Long
Open MyPath & "ver.log" For Input As #2
Do While Not EOF(2)
Line Input #2, sTmp
sVer = sVer & sTmp & vbCrLf
Loop
Close #2
sVers = Split(sVer, "@@")
nVer = CLng(Format(sVers(1), "0000") & Format(sVers(2), "0000") & Format(sVers(3), "0000"))
If nVer > CLng(Format(App.Major, "0000") & Format(App.Minor, "0000") & Format(App.Revision, "0000")) Then
tmrSUp.Tag = "1"
tmrSUp.Enabled = True
Else
tmrSUp.Tag = ""
tmrSUp.Enabled = True
End If
If Dir(MyPath & "ver.log") <> "" Then Kill MyPath & "ver.log"
Exit Sub
ChkErr:
tmrSUp.Tag = ""
tmrSUp.Enabled = True
End Sub