www.pudn.com > QQ2009.rar > frmKeyboard.frm, change:2009-11-15,size:19692b


VERSION 5.00 
Begin VB.Form frmKeyboard  
   BorderStyle     =   0  'None 
   Caption         =   "С" 
   ClientHeight    =   1650 
   ClientLeft      =   0 
   ClientTop       =   0 
   ClientWidth     =   5400 
   LinkTopic       =   "Form1" 
   Picture         =   "frmKeyboard.frx":0000 
   ScaleHeight     =   110 
   ScaleMode       =   3  'Pixel 
   ScaleWidth      =   360 
   ShowInTaskbar   =   0   'False 
   Begin QQ2009.cKeybCmd kL1  
      Height          =   360 
      Index           =   0 
      Left            =   165 
      Top             =   840 
      Width           =   375 
      _ExtentX        =   661 
      _ExtentY        =   0 
   End 
   Begin QQ2009.cKeybCmd kCapsLock  
      Height          =   360 
      Left            =   4395 
      Top             =   450 
      Width           =   960 
      _ExtentX        =   1693 
      _ExtentY        =   0 
      Caption1        =   "Caps Lock" 
   End 
   Begin QQ2009.cKeybCmd kS  
      Height          =   360 
      Index           =   0 
      Left            =   645 
      Top             =   450 
      Width           =   360 
      _ExtentX        =   635 
      _ExtentY        =   0 
      ButtonType      =   1 
   End 
   Begin QQ2009.cKeybCmd kShift  
      Height          =   360 
      Left            =   45 
      Top             =   450 
      Width           =   585 
      _ExtentX        =   1032 
      _ExtentY        =   0 
      Caption1        =   "Shift" 
   End 
   Begin QQ2009.cKeybCmd kBackSpace  
      Height          =   360 
      Left            =   4455 
      Top             =   60 
      Width           =   675 
      _ExtentX        =   1191 
      _ExtentY        =   0 
      Caption1        =   "" 
   End 
   Begin QQ2009.cKeybCmd kN  
      Height          =   360 
      Index           =   0 
      Left            =   165 
      Top             =   60 
      Width           =   375 
      _ExtentX        =   661 
      _ExtentY        =   0 
      ButtonType      =   1 
   End 
   Begin QQ2009.cKeybCmd kN  
      Height          =   360 
      Index           =   1 
      Left            =   555 
      Top             =   60 
      Width           =   375 
      _ExtentX        =   661 
      _ExtentY        =   0 
      ButtonType      =   1 
   End 
   Begin QQ2009.cKeybCmd kN  
      Height          =   360 
      Index           =   2 
      Left            =   945 
      Top             =   60 
      Width           =   375 
      _ExtentX        =   661 
      _ExtentY        =   0 
      ButtonType      =   1 
   End 
   Begin QQ2009.cKeybCmd kN  
      Height          =   360 
      Index           =   3 
      Left            =   1335 
      Top             =   60 
      Width           =   375 
      _ExtentX        =   661 
      _ExtentY        =   0 
      ButtonType      =   1 
   End 
   Begin QQ2009.cKeybCmd kN  
      Height          =   360 
      Index           =   4 
      Left            =   1725 
      Top             =   60 
      Width           =   375 
      _ExtentX        =   661 
      _ExtentY        =   0 
      ButtonType      =   1 
   End 
   Begin QQ2009.cKeybCmd kN  
      Height          =   360 
      Index           =   5 
      Left            =   2115 
      Top             =   60 
      Width           =   375 
      _ExtentX        =   661 
      _ExtentY        =   0 
      ButtonType      =   1 
   End 
   Begin QQ2009.cKeybCmd kN  
      Height          =   360 
      Index           =   6 
      Left            =   2505 
      Top             =   60 
      Width           =   375 
      _ExtentX        =   661 
      _ExtentY        =   0 
      ButtonType      =   1 
   End 
   Begin QQ2009.cKeybCmd kN  
      Height          =   360 
      Index           =   7 
      Left            =   2895 
      Top             =   60 
      Width           =   375 
      _ExtentX        =   661 
      _ExtentY        =   0 
      ButtonType      =   1 
   End 
   Begin QQ2009.cKeybCmd kN  
      Height          =   360 
      Index           =   8 
      Left            =   3285 
      Top             =   60 
      Width           =   375 
      _ExtentX        =   661 
      _ExtentY        =   0 
      ButtonType      =   1 
   End 
   Begin QQ2009.cKeybCmd kN  
      Height          =   360 
      Index           =   9 
      Left            =   3675 
      Top             =   60 
      Width           =   375 
      _ExtentX        =   661 
      _ExtentY        =   0 
      ButtonType      =   1 
   End 
   Begin QQ2009.cKeybCmd kN  
      Height          =   360 
      Index           =   10 
      Left            =   4065 
      Top             =   60 
      Width           =   375 
      _ExtentX        =   661 
      _ExtentY        =   0 
      ButtonType      =   1 
   End 
   Begin QQ2009.cKeybCmd kS  
      Height          =   360 
      Index           =   1 
      Left            =   1020 
      Top             =   450 
      Width           =   360 
      _ExtentX        =   635 
      _ExtentY        =   0 
      ButtonType      =   1 
   End 
   Begin QQ2009.cKeybCmd kS  
      Height          =   360 
      Index           =   2 
      Left            =   1395 
      Top             =   450 
      Width           =   360 
      _ExtentX        =   635 
      _ExtentY        =   0 
      ButtonType      =   1 
   End 
   Begin QQ2009.cKeybCmd kS  
      Height          =   360 
      Index           =   3 
      Left            =   1770 
      Top             =   450 
      Width           =   360 
      _ExtentX        =   635 
      _ExtentY        =   0 
      ButtonType      =   1 
   End 
   Begin QQ2009.cKeybCmd kS  
      Height          =   360 
      Index           =   4 
      Left            =   2145 
      Top             =   450 
      Width           =   360 
      _ExtentX        =   635 
      _ExtentY        =   0 
      ButtonType      =   1 
   End 
   Begin QQ2009.cKeybCmd kS  
      Height          =   360 
      Index           =   5 
      Left            =   2520 
      Top             =   450 
      Width           =   360 
      _ExtentX        =   635 
      _ExtentY        =   0 
      ButtonType      =   1 
   End 
   Begin QQ2009.cKeybCmd kS  
      Height          =   360 
      Index           =   6 
      Left            =   2895 
      Top             =   450 
      Width           =   360 
      _ExtentX        =   635 
      _ExtentY        =   0 
      ButtonType      =   1 
   End 
   Begin QQ2009.cKeybCmd kS  
      Height          =   360 
      Index           =   7 
      Left            =   3270 
      Top             =   450 
      Width           =   360 
      _ExtentX        =   635 
      _ExtentY        =   0 
      ButtonType      =   1 
   End 
   Begin QQ2009.cKeybCmd kS  
      Height          =   360 
      Index           =   8 
      Left            =   3645 
      Top             =   450 
      Width           =   360 
      _ExtentX        =   635 
      _ExtentY        =   0 
      ButtonType      =   1 
   End 
   Begin QQ2009.cKeybCmd kS  
      Height          =   360 
      Index           =   9 
      Left            =   4020 
      Top             =   450 
      Width           =   360 
      _ExtentX        =   635 
      _ExtentY        =   0 
      ButtonType      =   1 
   End 
   Begin QQ2009.cKeybCmd kL1  
      Height          =   360 
      Index           =   1 
      Left            =   555 
      Top             =   840 
      Width           =   375 
      _ExtentX        =   661 
      _ExtentY        =   0 
   End 
   Begin QQ2009.cKeybCmd kL1  
      Height          =   360 
      Index           =   2 
      Left            =   945 
      Top             =   840 
      Width           =   375 
      _ExtentX        =   661 
      _ExtentY        =   0 
   End 
   Begin QQ2009.cKeybCmd kL1  
      Height          =   360 
      Index           =   3 
      Left            =   1335 
      Top             =   840 
      Width           =   375 
      _ExtentX        =   661 
      _ExtentY        =   0 
   End 
   Begin QQ2009.cKeybCmd kL1  
      Height          =   360 
      Index           =   4 
      Left            =   1725 
      Top             =   840 
      Width           =   375 
      _ExtentX        =   661 
      _ExtentY        =   0 
   End 
   Begin QQ2009.cKeybCmd kL1  
      Height          =   360 
      Index           =   5 
      Left            =   2115 
      Top             =   840 
      Width           =   375 
      _ExtentX        =   661 
      _ExtentY        =   0 
   End 
   Begin QQ2009.cKeybCmd kL1  
      Height          =   360 
      Index           =   6 
      Left            =   2505 
      Top             =   840 
      Width           =   375 
      _ExtentX        =   661 
      _ExtentY        =   0 
   End 
   Begin QQ2009.cKeybCmd kL1  
      Height          =   360 
      Index           =   7 
      Left            =   2895 
      Top             =   840 
      Width           =   375 
      _ExtentX        =   661 
      _ExtentY        =   0 
   End 
   Begin QQ2009.cKeybCmd kL1  
      Height          =   360 
      Index           =   8 
      Left            =   3285 
      Top             =   840 
      Width           =   375 
      _ExtentX        =   661 
      _ExtentY        =   0 
   End 
   Begin QQ2009.cKeybCmd kL1  
      Height          =   360 
      Index           =   9 
      Left            =   3675 
      Top             =   840 
      Width           =   375 
      _ExtentX        =   661 
      _ExtentY        =   0 
   End 
   Begin QQ2009.cKeybCmd kL1  
      Height          =   360 
      Index           =   10 
      Left            =   4065 
      Top             =   840 
      Width           =   375 
      _ExtentX        =   661 
      _ExtentY        =   0 
   End 
   Begin QQ2009.cKeybCmd kL1  
      Height          =   360 
      Index           =   11 
      Left            =   4455 
      Top             =   840 
      Width           =   375 
      _ExtentX        =   661 
      _ExtentY        =   0 
   End 
   Begin QQ2009.cKeybCmd kL1  
      Height          =   360 
      Index           =   12 
      Left            =   4845 
      Top             =   840 
      Width           =   375 
      _ExtentX        =   661 
      _ExtentY        =   0 
   End 
   Begin QQ2009.cKeybCmd kL2  
      Height          =   360 
      Index           =   0 
      Left            =   165 
      Top             =   1230 
      Width           =   375 
      _ExtentX        =   661 
      _ExtentY        =   0 
   End 
   Begin QQ2009.cKeybCmd kL2  
      Height          =   360 
      Index           =   1 
      Left            =   555 
      Top             =   1230 
      Width           =   375 
      _ExtentX        =   661 
      _ExtentY        =   0 
   End 
   Begin QQ2009.cKeybCmd kL2  
      Height          =   360 
      Index           =   2 
      Left            =   945 
      Top             =   1230 
      Width           =   375 
      _ExtentX        =   661 
      _ExtentY        =   0 
   End 
   Begin QQ2009.cKeybCmd kL2  
      Height          =   360 
      Index           =   3 
      Left            =   1335 
      Top             =   1230 
      Width           =   375 
      _ExtentX        =   661 
      _ExtentY        =   0 
   End 
   Begin QQ2009.cKeybCmd kL2  
      Height          =   360 
      Index           =   4 
      Left            =   1725 
      Top             =   1230 
      Width           =   375 
      _ExtentX        =   661 
      _ExtentY        =   0 
   End 
   Begin QQ2009.cKeybCmd kL2  
      Height          =   360 
      Index           =   5 
      Left            =   2115 
      Top             =   1230 
      Width           =   375 
      _ExtentX        =   661 
      _ExtentY        =   0 
   End 
   Begin QQ2009.cKeybCmd kL2  
      Height          =   360 
      Index           =   6 
      Left            =   2505 
      Top             =   1230 
      Width           =   375 
      _ExtentX        =   661 
      _ExtentY        =   0 
   End 
   Begin QQ2009.cKeybCmd kL2  
      Height          =   360 
      Index           =   7 
      Left            =   2895 
      Top             =   1230 
      Width           =   375 
      _ExtentX        =   661 
      _ExtentY        =   0 
   End 
   Begin QQ2009.cKeybCmd kL2  
      Height          =   360 
      Index           =   8 
      Left            =   3285 
      Top             =   1230 
      Width           =   375 
      _ExtentX        =   661 
      _ExtentY        =   0 
   End 
   Begin QQ2009.cKeybCmd kL2  
      Height          =   360 
      Index           =   9 
      Left            =   3675 
      Top             =   1230 
      Width           =   375 
      _ExtentX        =   661 
      _ExtentY        =   0 
   End 
   Begin QQ2009.cKeybCmd kL2  
      Height          =   360 
      Index           =   10 
      Left            =   4065 
      Top             =   1230 
      Width           =   375 
      _ExtentX        =   661 
      _ExtentY        =   0 
   End 
   Begin QQ2009.cKeybCmd kL2  
      Height          =   360 
      Index           =   11 
      Left            =   4455 
      Top             =   1230 
      Width           =   375 
      _ExtentX        =   661 
      _ExtentY        =   0 
   End 
   Begin QQ2009.cKeybCmd kL2  
      Height          =   360 
      Index           =   12 
      Left            =   4845 
      Top             =   1230 
      Width           =   375 
      _ExtentX        =   661 
      _ExtentY        =   0 
   End 
   Begin VB.Image cmdClose  
      Height          =   105 
      Left            =   5205 
      ToolTipText     =   "ر" 
      Top             =   90 
      Width           =   105 
   End 
   Begin VB.Image imgCloseOver  
      Height          =   105 
      Left            =   5280 
      Picture         =   "frmKeyboard.frx":1D052 
      Top             =   360 
      Visible         =   0   'False 
      Width           =   105 
   End 
   Begin VB.Image imgClose  
      Height          =   105 
      Left            =   5160 
      Picture         =   "frmKeyboard.frx":1D13C 
      Top             =   360 
      Visible         =   0   'False 
      Width           =   105 
   End 
End 
Attribute VB_Name = "frmKeyboard" 
Attribute VB_GlobalNameSpace = False 
Attribute VB_Creatable = False 
Attribute VB_PredeclaredId = True 
Attribute VB_Exposed = False 
 
Private Declare Function SetWindowRgn Lib "user32" (ByVal hWnd As Long, ByVal hRgn As Long, ByVal bRedraw As Boolean) As Long 
Private Declare Function CreateRoundRectRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long, ByVal X3 As Long, ByVal Y3 As Long) As Long 
Public ParentBox As cPwdBox 
 
Dim str1(3) As String, str2(3) As String, str3 As String, str4 As String 
 
Dim KB_ShiftDown As Boolean, KB_CapsLock As Boolean 
 
Private Sub cmdClose_Click() 
    Unload Me 
End Sub 
 
Private Sub cmdClose_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single) 
    cmdClose.Picture = imgCloseOver.Picture 
End Sub 
 
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer) 
    Dim LF_Shift As Boolean 
    LF_Shift = KB_ShiftDown 
     
    KB_ShiftDown = (Shift = 1 Or Shift = 3 Or Shift = 5 Or Shift = 7) 
     
    If LF_Shift <> KB_ShiftDown Then 
        kShift.ButtonDown = KB_ShiftDown 
         
        UpdateKeysByShift 
        UpdateKeysByCapsLock 
    End If 
End Sub 
 
Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer) 
    Dim oS As Boolean, oC As Boolean 
    oS = KB_ShiftDown 
    oC = KB_CapsLock 
     
    KB_ShiftDown = (Shift = 1 Or Shift = 3 Or Shift = 5 Or Shift = 7) 
    KB_CapsLock = GetKB_CapsLockState 
     
    If oC <> KB_CapsLock Or oS <> KB_ShiftDown Then 
        kShift.ButtonDown = KB_ShiftDown 
        kKB_CapsLock.ButtonDown = KB_CapsLock 
         
        UpdateKeysByShift 
        UpdateKeysByCapsLock 
    End If 
End Sub 
 
Private Sub Form_Load() 
    KB_PassTopMost = True 
     
    SetWindowRgn Me.hWnd, CreateRoundRectRgn(0, 0, 361, 111, 2, 2), True 
     
    str1(0) = "`1234567890": str2(0) = "~!@#$%^&*()" 
    str1(1) = "-=\[];',./": str2(1) = "_+|{}:""<>?" 
    str1(2) = "abcdefghijklm" 
    str1(3) = "nopqrstuvwxyz" 
     
    Randomize 
     
    Dim r As Integer, I As Integer, j As Integer 
     
    For I = 0 To 3 
        Do 
            r = Rnd * Len(str1(I)) 
        Loop Until r > 0 
         
        str1(I) = Mid(str1(I), r) & Left(str1(I), r - 1) 
        For j = 1 To Len(str1(I)) 
            If I = 0 Then kN(j - 1).Caption1 = Mid(str1(I), j, 1) 
            If I = 1 Then kS(j - 1).Caption1 = Mid(str1(I), j, 1) 
            If I = 2 Then kL1(j - 1).Caption1 = Mid(str1(I), j, 1) 
            If I = 3 Then kL2(j - 1).Caption1 = Mid(str1(I), j, 1) 
        Next 
         
        If str2(I) <> "" Then 
            str2(I) = Mid(str2(I), r) & Left(str2(I), r - 1) 
            For j = 1 To Len(str2(I)) 
                If I = 0 Then kN(j - 1).Caption2 = Mid(str2(I), j, 1) 
                If I = 1 Then kS(j - 1).Caption2 = Mid(str2(I), j, 1) 
            Next 
        End If 
    Next 
End Sub 
 
Private Sub Form_LostFocus() 
    cmdClose_Click 
End Sub 
 
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single) 
    cmdClose.Picture = imgClose.Picture 
End Sub 
 
Private Sub Form_Unload(Cancel As Integer) 
    KB_PassTopMost = False 
End Sub 
 
Private Sub kBackSpace_Click() 
    ParentBox.AddCharAscii 8 
End Sub 
 
Private Sub kKB_CapsLock_Click() 
    KB_CapsLock = Not KB_CapsLock 
    kKB_CapsLock.ButtonDown = KB_CapsLock 
     
    UpdateKeysByCapsLock 
End Sub 
 
Private Sub kL1_Click(Index As Integer) 
    ParentBox.AddCharAscii Asc(kL1(Index).Caption1) 
End Sub 
 
Private Sub kL2_Click(Index As Integer) 
    ParentBox.AddCharAscii Asc(kL2(Index).Caption1) 
End Sub 
 
Private Sub kN_Click(Index As Integer) 
    If KB_ShiftDown Then 
        ParentBox.AddCharAscii Asc(kN(Index).Caption2) 
    Else 
        ParentBox.AddCharAscii Asc(kN(Index).Caption1) 
    End If 
End Sub 
 
Private Sub kS_Click(Index As Integer) 
    If KB_ShiftDown Then 
        ParentBox.AddCharAscii Asc(kS(Index).Caption2) 
    Else 
        ParentBox.AddCharAscii Asc(kS(Index).Caption1) 
    End If 
End Sub 
 
Private Sub kShift_Click() 
    KB_ShiftDown = Not KB_ShiftDown 
    kShift.ButtonDown = KB_ShiftDown 
     
    UpdateKeysByShift 
    UpdateKeysByCapsLock 
End Sub 
 
Private Sub UpdateKeysByCapsLock() 
    Dim I As Integer, j As Integer 
     
    If (KB_ShiftDown And KB_CapsLock) Or (KB_ShiftDown = False And KB_CapsLock = False) Then 
        For I = 2 To 3 
            str1(I) = LCase(str1(I)) 
            For j = 1 To Len(str1(I)) 
                If I = 2 Then kL1(j - 1).Caption1 = Mid(str1(I), j, 1) 
                If I = 3 Then kL2(j - 1).Caption1 = Mid(str1(I), j, 1) 
            Next 
        Next 
    Else 
        For I = 2 To 3 
            str1(I) = UCase(str1(I)) 
            For j = 1 To Len(str1(I)) 
                If I = 2 Then kL1(j - 1).Caption1 = Mid(str1(I), j, 1) 
                If I = 3 Then kL2(j - 1).Caption1 = Mid(str1(I), j, 1) 
            Next 
        Next 
    End If 
End Sub 
 
Private Sub UpdateKeysByShift() 
    Dim I As Integer, j As Integer 
     
    For I = 0 To 1 
        For j = 1 To Len(str1(I)) 
            If I = 0 Then kN(j - 1).MainCaption = KB_ShiftDown 
            If I = 1 Then kS(j - 1).MainCaption = KB_ShiftDown 
        Next 
    Next 
End Sub