我正在为使用 Windows Embedded Handheld 6.5 Classic 的手持条形码扫描仪编写程序。
我在我的表单上添加了一个 LinkLabel 并对其进行了编码,以便当您按下 Shift 并单击链接时,它会弹出一个输入框供您输入密码(我最终将用实际表单替换它,但它是InputBox 暂且)
当我放开班次并开始使用物理键(它目前是一个 4 位数字)输入我的密码时,它会将第一个字符视为我仍在进行班次。
有什么办法,在代码中,将其恢复,以便不按下班次?我曾尝试使用 keybd_event api,但它似乎不起作用
这是我尝试过的,但我似乎找不到其他可以尝试的方法。
Public Declare Sub keybd_event Lib "coredll.dll" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Integer, ByVal dwExtraInfo As Integer)
Private Sub lblTitle_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles lblTitle.Click
Try
If GetKeyState(Keys.ShiftKey) = 0 Then Exit Sub
Dim StaffPassword as String = "1234"
Dim _Continue As Boolean = False
keybd_event(VK_Shift, 0, KEYEVENTF_KEYDOWN, 0)
keybd_event(VK_Shift, 0, KEYEVENTF_KEYUP, 0)
Do Until _Continue
Dim _Password As String = InputBox("Please enter the staff password to go into the Admin Screen.", "Enter Password", "", True)
If Not _Password = StaffPassword Then
Dim _Ans As MsgBoxResult = MsgBox("You entered an incorrect password!" & vbNewLine & vbNewLine & "Would you like to try again?", MsgBoxStyle.Exclamation + MsgBoxStyle.YesNo, "Incorrect Password")
If _Ans = MsgBoxResult.No Then Exit Sub
Else
_Continue = True
End If
Loop
frmAdmin.ShowDialog()
Catch ex As Exception
MsgBox(ex.ToString, MsgBoxStyle.Critical, "Error")
End Try
End Sub
请问有人可以帮忙吗?