frmPassword.frm

 VERSION 5.00
Begin VB.Form frmPassword
   AutoRedraw      =   -1  'True
   BorderStyle     =   0  'None
   Caption         =   "ChatTool - kodeord"
   ClientHeight    =   2475
   ClientLeft      =   0
   ClientTop       =   0
   ClientWidth     =   3645
   ClipControls    =   0   'False
   LinkTopic       =   "Form1"
   ScaleHeight     =   2475
   ScaleWidth      =   3645
   ShowInTaskbar   =   0   'False
   Begin ChatTool.bgDugme bgCmdOk
      Height          =   435
      Left            =   450
      TabIndex        =   1
      Top             =   1860
      Width           =   1275
      _ExtentX        =   2249
      _ExtentY        =   767
      Caption         =   "&Ok"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
         Name            =   "Arial"
         Size            =   9.75
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Object.Width           =   -1
   End
   Begin ChatTool.bgFrame bgFramePassword
      Height          =   1245
      Left            =   240
      Top             =   480
      Width           =   3150
      _ExtentX        =   5556
      _ExtentY        =   2196
      Caption         =   "Type password"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
         Name            =   "Arial"
         Size            =   9.75
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Begin VB.TextBox txtPassword
         Appearance      =   0  'Flat
         BeginProperty Font
            Name            =   "Arial"
            Size            =   9.75
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   330
         IMEMode         =   3  'DISABLE
         Left            =   1260
         PasswordChar    =   "*"
         TabIndex        =   0
         Top             =   525
         Width           =   1500
      End
      Begin VB.Label lblPassword
         AutoSize        =   -1  'True
         Caption         =   "Password:"
         BeginProperty Font
            Name            =   "Arial"
            Size            =   9.75
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   240
         Left            =   165
         TabIndex        =   3
         Top             =   555
         Width           =   915
      End
   End
   Begin ChatTool.bgDugme bgCmdCancel
      Height          =   435
      Left            =   1980
      TabIndex        =   2
      Top             =   1860
      Width           =   1275
      _ExtentX        =   2249
      _ExtentY        =   767
      Caption         =   "&Cancel"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
         Name            =   "Arial"
         Size            =   9.75
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Object.Width           =   -1
   End
End
Attribute VB_Name = "frmPassword"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Aktiv As Boolean
Private WithEvents cmdClose As VBControlExtender
Attribute cmdClose.VB_VarHelpID = -1
Private strTmpText As String
Private blnOkPressed As Boolean

Private Sub bgCmdCancel_Click()
    Me.Hide
End Sub

Private Sub bgCmdOk_Click()
    blnOkPressed = True
    Me.Hide
End Sub

Private Sub cmdClose_ObjectEvent(Info As EventInfo)
    Me.Hide
End Sub

Private Sub Form_activate()
On Error GoTo err:

    If Aktiv = False Then
        Aktiv = True
        LoadSkin Me, Active, True, LoadIt, 1

    Else
        LoadSkin Me, Active, False, LoadIt
    End If
    SetFocusAPI txtPassword.hwnd
   
    Exit Sub
err:
    DebugLog "ERR - FrmPassword - Form_activate - " & err.Number & " - " & err.Description
End Sub

Private Sub Form_Deactivate()
    LoadSkin Me, NeActive, False, LoadIt
End Sub

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
    Select Case KeyCode
        Case vbKeyEscape: Me.Hide
    End Select
End Sub

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
    If Button = vbLeftButton Then
        If y <= intCloseHeight And x < intCloseLeft Then
            WindowMove Me
        End If
        If Screen.MousePointer <> vbDefault Then Screen.MousePointer = vbDefault
    End If
End Sub

Private Sub Form_Load()
On Error GoTo err:
    Dim i As Integer
    Aktiv = False
    Set cmdClose = Me.Controls.Add("ChatTool.bgclose", "cmdClose")
    cmdClose.Visible = True
    txtPassword.BackColor = Title.txtUnlockedColor
    lblPassword.BackColor = Title.BackColor
    txtPassword.Text = ""
    LoadGUIText
    Exit Sub
err:
    DebugLog "ERR - FrmPassword - Form_load - " & err.Number & " - " & err.Description
End Sub

Public Sub LoadGUIText()
    Me.Caption = GetText(800) 'Text: ChatTool - Password protection
    bgCmdCancel.Caption = GetText(801) 'Text: &Cancel
    bgCmdOk.Caption = GetText(802) 'Text: &Ok
    bgFramePassword.Caption = GetText(803) 'Text: Type password
    lblPassword.Caption = GetText(804) 'Text: Password:
End Sub

Public Function RequestPassword() As Boolean
On Error GoTo err:
    Dim result As Long
    If Not frmChatTool.Visible Then
        Me.Left = Int((Screen.Width - Me.Width) / 2)
        Me.Top = Int((Screen.Height - Me.Height) / 2)
    Else
        Me.Left = frmChatTool.Left + Int((frmChatTool.Width - Me.Width) / 2)
        Me.Top = frmChatTool.Top + Int((frmChatTool.Height - Me.Height) / 2)
    End If
    blnOkPressed = False
    SetFocusAPI frmPassword.hwnd
    result = SetForegroundWindow(Me.hwnd)
    txtPassword.Text = ""
    Me.Show vbModal
    If blnOkPressed Then
        If frmPassword.txtPassword <> frmChatTool.strPassword Then
            strTmpText = GetText(809) 'Text: Wrong password
            frmChatTool.MessageBox.MsgBox Me, strTmpText, vbExclamation
            RequestPassword = False
        Else
            RequestPassword = True
            frmChatTool.blnWM_SHOWWINDOW_Allowed = True
        End If
    Else
        RequestPassword = False
    End If
    Exit Function
err:
    DebugLog "ERR - FrmPassword - RequestPassword - " & err.Number & " - " & err.Description
End Function

Public Sub Reset()
    txtPassword = ""
    SetFocusAPI txtPassword.hwnd
End Sub

Private Sub txtPassword_KeyPress(KeyAscii As Integer)
    If KeyAscii = vbKeyReturn Then
        bgCmdOk_Click
        KeyAscii = 0
    End If
End Sub

Project Homepage: