Torna al Thread

'ometto dichiarazioni voci menù Public Declare Function GetAsyncKeyState Lib "user32" Alias "GetAsyncKeyState" (ByVal vKey As Keys) As Integer Dim T As New Threading.Thread(AddressOf get_num) Sub Main() Init() thread_start() nfiIcona.Visible = True Application.Run() End Sub sub init() 'creo il menù ... ... end sub sub thread_start() T.IsBackground = True T.Start() End Sub sub get_num() pwctrl = My.Computer.Registry.GetValue("HKEY_CURRENT_USER\PcLockInfo", "Pw", Nothing) If pwctrl <> "" Then ReDim pos(0 To Len(pwctrl) - 1) For i = 0 To Len(pwctrl) - 1 c += 1 pos(i) = Mid(pwctrl, c, 1) Next i Do For e = 48 To 57 b = 0 b = GetAsyncKeyState(e) ' b = -32767 If m < Len(pwctrl) Then If b = -32767 And Chr(e) = pos(m) Then m += 1 h = h & Chr(e) Else h = "" m = 0 End If End If Threading.Thread.Sleep(100) If h = pwctrl Then Exit For End If Next e Loop Until h = pwctrl MsgBox(h, 16, "") Else nopass() End If end sub
Copyright © dotNetHell.it 2002-2024
Running on Windows Server 2008 R2 Standard, SQL Server 2012 & ASP.NET 3.5