VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
Object = "{48E59290-9880-11CF-9754-00AA00C00908}#1.0#0"; "msinet.ocx"
Begin VB.Form frmLogin 
   BackColor       =   &H00FFFFFF&
   BorderStyle     =   0  'None
   Caption         =   "Login"
   ClientHeight    =   3330
   ClientLeft      =   2790
   ClientTop       =   3045
   ClientWidth     =   5010
   BeginProperty Font 
      Name            =   "Tahoma"
      Size            =   8.25
      Charset         =   204
      Weight          =   400
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   Icon            =   "frmLogin.frx":0000
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   1967.475
   ScaleMode       =   0  'User
   ScaleWidth      =   4704.119
   ShowInTaskbar   =   0   'False
   StartUpPosition =   2  'CenterScreen
   Begin VB.Frame fraMainFrame 
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      ForeColor       =   &H80000008&
      Height          =   3060
      Left            =   160
      TabIndex        =   0
      Top             =   68
      Width           =   4695
      Begin InetCtlsObjects.Inet Inet2 
         Left            =   1320
         Top             =   240
         _ExtentX        =   1005
         _ExtentY        =   1005
         _Version        =   393216
      End
      Begin VB.Frame Frame1 
         Appearance      =   0  'Flat
         BackColor       =   &H80000005&
         ForeColor       =   &H80000008&
         Height          =   495
         Left            =   120
         TabIndex        =   14
         Top             =   2450
         Width           =   4455
         Begin MSComctlLib.ProgressBar pgbUpdate 
            Height          =   150
            Left            =   2760
            TabIndex        =   15
            Top             =   225
            Visible         =   0   'False
            Width           =   1560
            _ExtentX        =   2752
            _ExtentY        =   265
            _Version        =   393216
            Appearance      =   0
            Scrolling       =   1
         End
         Begin VB.Label lblStatus 
            Appearance      =   0  'Flat
            BackColor       =   &H80000005&
            Caption         =   "Waiting for user login..."
            ForeColor       =   &H80000008&
            Height          =   195
            Left            =   105
            TabIndex        =   16
            Top             =   195
            Width           =   2670
         End
         Begin VB.Label Label2 
            Appearance      =   0  'Flat
            BackColor       =   &H80000005&
            Caption         =   " Status: "
            ForeColor       =   &H80000008&
            Height          =   255
            Left            =   120
            TabIndex        =   17
            Top             =   0
            Width           =   615
         End
      End
      Begin VB.Frame fraLogin 
         Appearance      =   0  'Flat
         BackColor       =   &H80000005&
         ForeColor       =   &H80000008&
         Height          =   1575
         Left            =   120
         TabIndex        =   9
         Top             =   840
         Width           =   4455
         Begin VB.PictureBox Picture1 
            Appearance      =   0  'Flat
            BackColor       =   &H80000005&
            BorderStyle     =   0  'None
            ForeColor       =   &H80000008&
            Height          =   1215
            Left            =   120
            ScaleHeight     =   1215
            ScaleWidth      =   4215
            TabIndex        =   10
            Top             =   240
            Width           =   4215
            Begin VB.CheckBox chkSavePassword 
               Alignment       =   1  'Right Justify
               BackColor       =   &H00FFFFFF&
               Caption         =   "Save Username and Password"
               Height          =   375
               Left            =   2760
               TabIndex        =   3
               Top             =   240
               Width           =   1455
            End
            Begin VB.TextBox txtUserName 
               Height          =   315
               IMEMode         =   3  'DISABLE
               Left            =   0
               TabIndex        =   1
               Top             =   240
               Width           =   2160
            End
            Begin VB.CommandButton cmdCancel 
               Appearance      =   0  'Flat
               BackColor       =   &H00FFFFFF&
               Cancel          =   -1  'True
               Caption         =   "Cancel"
               Height          =   315
               Left            =   3480
               MaskColor       =   &H00FFFFFF&
               TabIndex        =   5
               Top             =   840
               Width           =   735
            End
            Begin VB.CommandButton cmdOK 
               Appearance      =   0  'Flat
               BackColor       =   &H00FFFFFF&
               Caption         =   "OK"
               Height          =   315
               Left            =   2640
               TabIndex        =   4
               Top             =   840
               Width           =   735
            End
            Begin VB.TextBox txtPassword 
               Height          =   315
               IMEMode         =   3  'DISABLE
               Left            =   0
               PasswordChar    =   "*"
               TabIndex        =   2
               Top             =   840
               Width           =   2160
            End
            Begin VB.Label lblLabels 
               Appearance      =   0  'Flat
               BackColor       =   &H80000005&
               Caption         =   "&User Name:"
               ForeColor       =   &H80000008&
               Height          =   270
               Index           =   0
               Left            =   0
               TabIndex        =   12
               Top             =   0
               Width           =   840
            End
            Begin VB.Label lblLabels 
               Appearance      =   0  'Flat
               BackColor       =   &H80000005&
               Caption         =   "&Password:"
               ForeColor       =   &H80000008&
               Height          =   270
               Index           =   1
               Left            =   0
               TabIndex        =   11
               Top             =   600
               Width           =   840
            End
         End
         Begin VB.Label Label1 
            Appearance      =   0  'Flat
            AutoSize        =   -1  'True
            BackColor       =   &H80000005&
            Caption         =   " Login: "
            ForeColor       =   &H80000008&
            Height          =   195
            Left            =   120
            TabIndex        =   13
            Top             =   0
            Width           =   525
         End
      End
      Begin VB.PictureBox picLogo 
         Appearance      =   0  'Flat
         AutoSize        =   -1  'True
         BackColor       =   &H80000005&
         BorderStyle     =   0  'None
         ForeColor       =   &H80000008&
         Height          =   480
         Left            =   120
         MouseIcon       =   "frmLogin.frx":058A
         MousePointer    =   99  'Custom
         Picture         =   "frmLogin.frx":06DC
         ScaleHeight     =   480
         ScaleWidth      =   480
         TabIndex        =   6
         ToolTipText     =   "Toolbar"
         Top             =   240
         Width           =   480
      End
      Begin InetCtlsObjects.Inet Inet1 
         Left            =   720
         Top             =   240
         _ExtentX        =   1005
         _ExtentY        =   1005
         _Version        =   393216
      End
      Begin VB.Label lblVersion 
         Alignment       =   1  'Right Justify
         AutoSize        =   -1  'True
         BackColor       =   &H00FFFFFF&
         Caption         =   "Version 2.0"
         BeginProperty Font 
            Name            =   "Tahoma"
            Size            =   12
            Charset         =   204
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00808080&
         Height          =   285
         Left            =   3180
         TabIndex        =   8
         Tag             =   "Version"
         Top             =   555
         Width           =   1365
      End
      Begin VB.Label lblProductName 
         Alignment       =   1  'Right Justify
         BackColor       =   &H00FFFFFF&
         Caption         =   "Viral Toolbar Builder"
         BeginProperty Font 
            Name            =   "Tahoma"
            Size            =   15.75
            Charset         =   204
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00808080&
         Height          =   465
         Left            =   960
         TabIndex        =   7
         Tag             =   "Product"
         Top             =   150
         Width           =   3600
      End
   End
End
Attribute VB_Name = "frmLogin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Public bLoginSucceeded As Boolean

Private Sub Form_Load()
    SetWindowPos hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE + SWP_NOSIZE
    
    lblVersion.Caption = "Version " & App.Major & "." & App.Minor & "." & App.Revision
    
    bLoginSucceeded = False
    'txtUserName.Text = "DEMO"
    'txtUserName.Enabled = False
    'txtPassword.Enabled = False
    'chkSavePassword.Enabled = False
    If CLng(GetSetting(App.Title, "Reg", "Save", "0")) = 1 Then
        chkSavePassword.Value = 1
        txtUserName.Text = GetSetting(App.Title, "Reg", "Username", "DEMO")
        txtPassword.Text = GetSetting(App.Title, "Reg", "Password", "")
    End If
   
End Sub

Private Sub cmdCancel_Click()
    Me.Hide
End Sub

Private Sub cmdOk_Click()

    Dim bOk As Boolean
    Dim bNeedRestart As Boolean
    Dim iServerVersion As Long
    Dim strBatFileName As String
    Dim iFile As Long
    
    cmdOk.Enabled = False
    cmdCancel.Enabled = False
    lblStatus.Caption = "Checking username and password..."
        
    
    'CheckLicense Inet1, txtUserName.Text, txtPassword.Text, CStr(GetUniqueValue), bOk
        
    If Month(Date) > 3 Or Year(Date) > 2004 Then
        MsgBox "DEMO Period was expired"
        bOk = False
        g_iMode = 0
        Me.Hide
        Exit Sub
    Else
        g_iMode = 2
        bOk = True
    End If
        
    
    
    lblStatus.Caption = ""
    bLoginSucceeded = False
    
    If bOk And g_iMode > 0 And g_iMode < 5 Then
    
        If chkSavePassword.Value = 1 Then
            SaveSetting App.Title, "Reg", "Username", txtUserName.Text
            SaveSetting App.Title, "Reg", "Password", txtPassword.Text
            SaveSetting App.Title, "Reg", "Save", "1"
        Else
            SaveSetting App.Title, "Reg", "Save", "0"
        End If
        
        g_strProviderName = txtUserName.Text
        g_strProviderPassword = txtPassword.Text
        g_strProvideUnique = CStr(GetUniqueValue())
        
        bLoginSucceeded = True
        
        ' Update program
        bOk = UpdateProgram(bNeedRestart)
        bOk = False
        bNeedRestart = False
        If bOk And bNeedRestart Then
            ' Generate bat-file to restart program after program closing
            On Error Resume Next
            Kill App.Path & "\" & BAT_FILE_NAME
            On Error GoTo START_PROGRAM
    
            iFile = FreeFile
            Open App.Path & "\" & BAT_FILE_NAME For Append As #iFile
            Print #iFile, "@echo off"
            Print #iFile, left(App.Path, 2)
            Print #iFile, "cd """ & App.Path & """"
            Print #iFile, ":try"
            Print #iFile, "del """ & App.EXEName & ".exe"""
            Print #iFile, "if exist """ & App.EXEName & ".exe"" goto try"
            Print #iFile, "rename ""~" & App.EXEName & ".exe"" """ & App.EXEName & ".exe"""
            Print #iFile, """" & App.EXEName & ".exe """
            Print #iFile, "del """ + App.Path & "\" & BAT_FILE_NAME & """"
            Close #iFile
            
            MsgBox "New version downloaded and installed. Now program will be restarted.", vbInformation
            
            Shell """" & App.Path + "\" & BAT_FILE_NAME & """", vbHide
            bLoginSucceeded = False
            Me.Hide
        End If
START_PROGRAM:
        lblStatus.Caption = "Starting program..."
        Me.Hide
    ElseIf Not bOk Then
        MsgBox "Toolbar Generator isn't able to receive a reply from our server. Please make sure you are connected to the Internet and if you have a firewall it is setup to allow Toolbar Generator to connect to the Internet.", vbCritical
        cmdOk.Enabled = True
        cmdCancel.Enabled = True
    ElseIf g_iMode = 0 Then
        MsgBox "The username and/or password entered can't be verified by our server. Please check that you've entered them correctly.", vbCritical
        cmdOk.Enabled = True
        cmdCancel.Enabled = True
    ElseIf g_iMode = 9 Then
        MsgBox "This software is licensed on a different  computer. Your browser will now open for you to activate a license  for this computer.", vbCritical
        cmdOk.Enabled = True
        cmdCancel.Enabled = True
        ShellExecute hwnd, "open", "http://www.viraltoolbarbuilder.com", "", "", 1
        Me.Hide
    End If
    
        
End Sub

Private Sub picLogo_Click()
    ShellExecute hwnd, "open", "http://www.viraltoolbarbuilder.com", "", "", 1
End Sub
