VERSION 2.00
Begin Form AdvSettings 
   BackColor       =   &H00C0C0C0&
   BorderStyle     =   3  'Fixed Double
   Caption         =   "Advanced Settings"
   ClientHeight    =   1770
   ClientLeft      =   2175
   ClientTop       =   2265
   ClientWidth     =   6015
   ControlBox      =   0   'False
   Height          =   2205
   Left            =   2100
   LinkTopic       =   "Form2"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   1770
   ScaleWidth      =   6015
   Top             =   1905
   Width           =   6165
   Begin CommandButton Command3 
      Cancel          =   -1  'True
      Caption         =   "Cancel"
      Height          =   330
      Left            =   2985
      TabIndex        =   6
      Top             =   1245
      Width           =   1215
   End
   Begin CommandButton Command1 
      Caption         =   "OK"
      Default         =   -1  'True
      Height          =   330
      Left            =   1650
      TabIndex        =   5
      Top             =   1245
      Width           =   1215
   End
   Begin PictureBox U 
      AutoSize        =   -1  'True
      Height          =   360
      Left            =   4080
      Picture         =   ADVSETTI.FRX:0000
      ScaleHeight     =   330
      ScaleWidth      =   135
      TabIndex        =   12
      TabStop         =   0   'False
      Top             =   3660
      Visible         =   0   'False
      Width           =   165
   End
   Begin PictureBox D 
      AutoSize        =   -1  'True
      Height          =   360
      Left            =   3900
      Picture         =   ADVSETTI.FRX:012A
      ScaleHeight     =   330
      ScaleWidth      =   135
      TabIndex        =   11
      TabStop         =   0   'False
      Top             =   3660
      Visible         =   0   'False
      Width           =   165
   End
   Begin PictureBox N 
      AutoSize        =   -1  'True
      Height          =   360
      Left            =   4260
      Picture         =   ADVSETTI.FRX:0254
      ScaleHeight     =   330
      ScaleWidth      =   135
      TabIndex        =   10
      TabStop         =   0   'False
      Top             =   3660
      Visible         =   0   'False
      Width           =   165
   End
   Begin PictureBox SpinButton 
      AutoSize        =   -1  'True
      BackColor       =   &H00C0C0C0&
      Height          =   360
      Index           =   0
      Left            =   2835
      ScaleHeight     =   330
      ScaleWidth      =   135
      TabIndex        =   9
      TabStop         =   0   'False
      Top             =   255
      Width           =   165
   End
   Begin SSFrame Frame3D1 
      ForeColor       =   &H00000000&
      Height          =   420
      Index           =   0
      Left            =   2430
      TabIndex        =   8
      Top             =   180
      Width           =   345
      Begin TextBox tDelay 
         Alignment       =   1  'Right Justify
         BackColor       =   &H00C0C0C0&
         BorderStyle     =   0  'None
         Height          =   216
         Left            =   36
         MaxLength       =   2
         MultiLine       =   -1  'True
         TabIndex        =   2
         Tag             =   "h"
         Text            =   "99"
         Top             =   150
         Width           =   276
      End
   End
   Begin SSFrame Frame3D1 
      ForeColor       =   &H00000000&
      Height          =   420
      Index           =   2
      Left            =   2430
      TabIndex        =   7
      Top             =   630
      Width           =   345
      Begin TextBox tGiveaway 
         Alignment       =   1  'Right Justify
         BackColor       =   &H00C0C0C0&
         BorderStyle     =   0  'None
         Height          =   210
         Left            =   30
         MaxLength       =   2
         MultiLine       =   -1  'True
         TabIndex        =   4
         Tag             =   "h"
         Text            =   "99"
         Top             =   150
         Width           =   270
      End
   End
   Begin PictureBox SpinButton2 
      AutoSize        =   -1  'True
      BackColor       =   &H00C0C0C0&
      Height          =   360
      Index           =   0
      Left            =   2835
      ScaleHeight     =   330
      ScaleWidth      =   135
      TabIndex        =   0
      TabStop         =   0   'False
      Top             =   705
      Width           =   165
   End
   Begin Label Label2 
      BackColor       =   &H00C0C0C0&
      BackStyle       =   0  'Transparent
      Caption         =   "times before next update check"
      Height          =   240
      Index           =   3
      Left            =   3045
      TabIndex        =   14
      Top             =   780
      Width           =   2775
   End
   Begin Label Label2 
      BackColor       =   &H00C0C0C0&
      BackStyle       =   0  'Transparent
      Caption         =   "seconds"
      Height          =   240
      Index           =   0
      Left            =   3045
      TabIndex        =   13
      Top             =   330
      Width           =   1500
   End
   Begin Label Label2 
      Alignment       =   1  'Right Justify
      BackColor       =   &H00C0C0C0&
      BackStyle       =   0  'Transparent
      Caption         =   "Update display every"
      Height          =   240
      Index           =   1
      Left            =   105
      TabIndex        =   1
      Top             =   330
      Width           =   2280
   End
   Begin Label Label2 
      Alignment       =   1  'Right Justify
      BackColor       =   &H00C0C0C0&
      BackStyle       =   0  'Transparent
      Caption         =   "Give control to Windows"
      Height          =   240
      Index           =   2
      Left            =   0
      TabIndex        =   3
      Top             =   780
      Width           =   2370
   End
End
Option Explicit
Declare Function GetTickCount Lib "User" () As Long
Declare Function GetAsyncKeyState Lib "User" (ByVal vKey As Integer) As Integer

Dim LastY As Single
Dim LastDirection As String
Dim tVal As Integer

Sub Command1_Click ()
gtDelay = tDelay.Text
gtGiveaway = tGiveaway.Text
Unload Me
End Sub

Sub Command3_Click ()
   gtGiveaway = SavedtGiveaway
   gtDelay = SavedtDelay
   Unload Me
End Sub

Sub Form_Load ()
Dim InitialHeight As Integer
    InitialHeight = SpinButton(0).Height
    
    SpinButton(0).Picture = N.Picture       'Set to the Normal Spin Button
    SpinButton(0).Top = SpinButton(0).Top + (InitialHeight - SpinButton(0).Height) / 2
    SpinButton2(0).Picture = N.Picture       'Set to the Normal Spin Button
    SpinButton2(0).Top = SpinButton2(0).Top + (InitialHeight - SpinButton2(0).Height) / 2
   AdvSettings.Left = Screen.Width / 2 - (AdvSettings.Width / 2)
   AdvSettings.Top = Screen.Height / 2 - (AdvSettings.Height / 2)
   tGiveaway.Text = gtGiveaway
   tDelay.Text = gtDelay
End Sub

Sub MoveDown (c As Control)
Dim CurVal As Integer
CurVal% = Val(c.Text) - 1
If CurVal% > 0 Then c.Text = CurVal%
End Sub

Sub MoveUp (c As Control)
Dim CurVal As Integer
CurVal% = Val(c.Text) + 1
If CurVal% < 100 Then c.Text = CurVal%
End Sub

Sub SpinButton_MouseDown (Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)

Const VK_LBUTTON = &H1
Const TIME_DELAY = 180      ' Time delay between Spin Button Events

Dim dwEvent As Long
LastY = Y
' Make sure that the Spin Button Event occurs at least once
dwEvent = GetTickCount() - TIME_DELAY

SpinIt:

   ' Do this while the user holds down the left mouse button
   Do While (GetAsyncKeyState(VK_LBUTTON) And &H8000) = -32768

        ' Break out of the loop if we haven't waited long enough
        If dwEvent + TIME_DELAY > GetTickCount() Then GoTo Break:

        ' If the user wants to increment the counter
        If Y > (SpinButton(Index).Height \ 2) Then
            SpinButton(Index).Picture = d.Picture  ' Set Picture to Up
            Call MoveDown(tDelay)
            LastDirection$ = "d"
        End If

        ' If the user wants to decrement the counter
        If Y < (SpinButton(Index).Height \ 2) Then
            SpinButton(Index).Picture = u.Picture   ' Set Picture to Down
            Call MoveUp(tDelay)
            LastDirection$ = "u"
        End If

        ' Save the last time the Spin Button was active
        dwEvent = GetTickCount()
    Loop
    
    ' Set the Picture to Normal
    SpinButton(Index).Picture = N.Picture
    tDelay.SetFocus
    DoEvents
    
    Exit Sub

Break:
    GoTo SpinIt:


End Sub

Sub SpinButton2_MouseDown (Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)

Const VK_LBUTTON = &H1
Const TIME_DELAY = 180      ' Time delay between Spin Button Events

Dim dwEvent As Long
LastY = Y
' Make sure that the Spin Button Event occurs at least once
dwEvent = GetTickCount() - TIME_DELAY

SpinIt2:

   ' Do this while the user holds down the left mouse button
   Do While (GetAsyncKeyState(VK_LBUTTON) And &H8000) = -32768

        ' Break out of the loop if we haven't waited long enough
        If dwEvent + TIME_DELAY > GetTickCount() Then GoTo Break2:

        ' If the user wants to increment the counter
        If Y > (SpinButton2(Index).Height \ 2) Then
            SpinButton2(Index).Picture = d.Picture  ' Set Picture to Up
            Call MoveDown(tGiveaway)
            LastDirection$ = "d"
        End If

        ' If the user wants to decrement the counter
        If Y < (SpinButton2(Index).Height \ 2) Then
            SpinButton2(Index).Picture = u.Picture   ' Set Picture to Down
            Call MoveUp(tGiveaway)
            LastDirection$ = "u"
        End If

        ' Save the last time the Spin Button was active
        dwEvent = GetTickCount()
    Loop
    
    ' Set the Picture to Normal
    SpinButton2(Index).Picture = N.Picture
    tGiveaway.SetFocus
    DoEvents
    
    Exit Sub

Break2:
    GoTo SpinIt2:



End Sub

Sub tDelay_GotFocus ()
tDelay.SelStart = 0
tDelay.SelLength = 2

End Sub

Sub tDelay_KeyPress (KeyAscii As Integer)
If KeyAscii >= 32 Then
   If KeyAscii < Asc("0") Or KeyAscii > Asc("9") Then KeyAscii = 0
End If

End Sub

Sub tDelay_LostFocus ()
tVal = Val(tDelay.Text)
If tVal < 1 Or tVal > 99 Then
   tVal = 99
End If
tDelay.Text = Format$(tVal, "0")

End Sub

Sub tGiveaway_GotFocus ()
tGiveaway.SelStart = 0
tGiveaway.SelLength = 2

End Sub

Sub tGiveaway_KeyPress (KeyAscii As Integer)
If KeyAscii >= 32 Then
   If KeyAscii < Asc("0") Or KeyAscii > Asc("9") Then KeyAscii = 0
End If

End Sub

Sub tGiveaway_LostFocus ()
tVal = Val(tGiveaway.Text)
If tVal < 1 Or tVal > 99 Then
   tVal = 99
End If
tGiveaway.Text = Format$(tVal, "0")

End Sub

