Projects

Find all our projects in development below.
All source code is GNU General Public License (GPL)

QuickQuery Half-Life Edition

Browsing QuickQuery HL Edition/KeyGen/MainForm.frm (4.84 KB)

VERSION 5.00
Begin VB.Form MainForm 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "QQHL Reg KeyGen"
   ClientHeight    =   3255
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   4335
   BeginProperty Font 
      Name            =   "Tahoma"
      Size            =   8.25
      Charset         =   0
      Weight          =   400
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   Icon            =   "MainForm.frx":0000
   MaxButton       =   0   'False
   ScaleHeight     =   3255
   ScaleWidth      =   4335
   StartUpPosition =   2  'CenterScreen
   Begin VB.CommandButton Command3 
      Caption         =   "Copy &Code"
      Height          =   375
      Left            =   1440
      TabIndex        =   5
      Top             =   2760
      Width           =   1215
   End
   Begin VB.CommandButton Command2 
      Caption         =   "E&xit"
      Height          =   375
      Left            =   3000
      TabIndex        =   6
      Top             =   2760
      Width           =   1215
   End
   Begin VB.CommandButton Command1 
      Caption         =   "Copy &Name"
      Height          =   375
      Left            =   120
      TabIndex        =   4
      Top             =   2760
      Width           =   1215
   End
   Begin VB.Frame Frame2 
      Caption         =   "Registration &Code:"
      Height          =   1215
      Left            =   120
      TabIndex        =   2
      Top             =   1320
      Width           =   4095
      Begin VB.TextBox txtKey 
         BackColor       =   &H8000000F&
         Height          =   675
         Left            =   240
         Locked          =   -1  'True
         MultiLine       =   -1  'True
         TabIndex        =   3
         Top             =   360
         Width           =   3615
      End
   End
   Begin VB.Frame Frame1 
      Caption         =   "Registration &Name:"
      Height          =   1095
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   4095
      Begin VB.TextBox txtName 
         Height          =   315
         Left            =   240
         MaxLength       =   100
         TabIndex        =   1
         Top             =   360
         Width           =   3615
      End
      Begin VB.Label Label1 
         Alignment       =   1  'Right Justify
         AutoSize        =   -1  'True
         Caption         =   "Length: 0"
         Height          =   195
         Left            =   3165
         TabIndex        =   7
         Top             =   720
         Width           =   690
      End
   End
End
Attribute VB_Name = "MainForm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Const WM_COPY = &H301

Private Declare Function InitCommonControls Lib "comctl32.dll" () As Long

Private Sub Command1_Click()
    txtName.SelStart = 0
    txtName.SelLength = Len(txtName.Text)
    SendMessage txtName.hWnd, WM_COPY, 0&, 0&
End Sub


Private Sub Command2_Click()
    Unload Me
End Sub

Private Sub Command3_Click()
    txtKey.SelStart = 0
    txtKey.SelLength = Len(txtKey.Text)
    SendMessage txtKey.hWnd, WM_COPY, 0&, 0&
End Sub

Private Sub Form_Initialize()
    Call InitCommonControls
End Sub

Private Sub txtName_Change()
On Error GoTo ErrHandler
Dim sRegName As String
Dim aessystem As New clsAES
Dim tmpkey As String
Dim tmparray() As String
Dim i As Long
    sRegName = txtName.Text
    Label1.Caption = "Length: " & Len(sRegName)
    If Len(sRegName) < 4 Then
        txtKey.Text = "(registration name too short; 4 chars min.)"
        Exit Sub
    End If
    sRegName = Mid(sRegName, 2) + CStr(Asc(Left(sRegName, 1)))
    sRegName = aessystem.EncryptString(sRegName, _
    Replace(Mid(sRegName, 1, 1) & "0xEgZ*01-11" & Mid(sRegName, _
    Len(sRegName), 1), "*", Hex(Asc(Mid(sRegName, 4, 1)))), True)
    sRegName = SecureHash(StrReverse(sRegName))
    Set aessystem = Nothing
    tmpkey = ""
    For i = 1 To Len(sRegName) Step 4
        tmpkey = tmpkey + IIf(i = 1, "", "-") + Mid(sRegName, i, 4)
    Next i
    tmparray = Split(tmpkey, "-")
    SwapString tmparray(3), tmparray(9)
    SwapString tmparray(0), tmparray(6)
    SwapString tmparray(7), tmparray(2)
    SwapString tmparray(8), tmparray(4)
    tmpkey = ""
    For i = 0 To 9
        tmpkey = tmpkey + IIf(i = 0, "", "-") + tmparray(i)
    Next i
    txtKey.Text = tmpkey
    Exit Sub
ErrHandler:
    txtKey.Text = "(error generating key)"
End Sub


Download QuickQuery HL Edition/KeyGen/MainForm.frm

Back to file list


Back to project page