VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Clipboard Monitor"
   ClientHeight    =   5610
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   9555
   Icon            =   "Form1.frx":0000
   LinkTopic       =   "Form1"
   ScaleHeight     =   5610
   ScaleWidth      =   9555
   StartUpPosition =   2  'CenterScreen
   Begin VB.CommandButton btnCopy 
      Caption         =   "&Copy above text into clipboard"
      Height          =   495
      Left            =   3330
      TabIndex        =   3
      Top             =   4920
      Width           =   2895
   End
   Begin VB.CommandButton btnClear 
      Caption         =   "&Clear Entries"
      Height          =   495
      Left            =   150
      TabIndex        =   2
      Top             =   4920
      Width           =   2895
   End
   Begin VB.TextBox Text1 
      Height          =   3975
      Left            =   150
      MultiLine       =   -1  'True
      ScrollBars      =   2  'Vertical
      TabIndex        =   1
      Top             =   720
      Width           =   9255
   End
   Begin VB.CommandButton btnExit 
      Caption         =   "E&xit"
      Height          =   495
      Left            =   6510
      TabIndex        =   4
      Top             =   4920
      Width           =   2895
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "Clipboard Monitor"
      BeginProperty Font 
         Name            =   "Comic Sans MS"
         Size            =   18
         Charset         =   0
         Weight          =   400
         Underline       =   -1  'True
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H000000FF&
      Height          =   495
      Left            =   3210
      TabIndex        =   0
      Top             =   75
      Width           =   3000
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Sub Form_Load()
 If clipboard_is_hooked = False Then
  clipboard_is_hooked = hook_clipboard(Me.hWnd)
 End If
End Sub

Private Sub Form_Unload(Cancel As Integer)
 If clipboard_is_hooked = True Then
  clipboard_is_hooked = unhook_clipboard(Me.hWnd)
 End If
End Sub

Private Sub Form_Activate()
 Text1.SetFocus
End Sub

Private Sub btnExit_Click()
 Unload Me
End Sub

Private Sub btnClear_Click()
 Text1.Text = ""
End Sub

Private Sub Text1_Change()
 'whenever text in the textbox is changed, move the cursor to the end of the text
 Text1.SelStart = Len(Text1.Text)
End Sub

Private Sub Text1_GotFocus()
 'whenever the textbox gains focus, move the cursor to the end of the text
 Text1.SelStart = Len(Text1.Text)
End Sub

'Copy above text into clipboard
Private Sub btnCopy_Click()
 If clipboard_is_hooked = True Then
  clipboard_is_hooked = unhook_clipboard(Me.hWnd)
 End If
 Clipboard.Clear
 Clipboard.SetText Text1.Text
 If clipboard_is_hooked = False Then
  Text1.Text = ""
  clipboard_is_hooked = hook_clipboard(Me.hWnd)
 End If
End Sub

Private Sub Form_Resize()
If Me.Width > Label1.Width Then
 Label1.Left = (Me.Width - Label1.Width) / 2
End If
If Me.Width > 420 Then
 Text1.Width = Me.Width - 420
End If
If Me.Width > Text1.Width Then
 Text1.Left = (Me.Width - Text1.Width) / 2
End If
If Me.Height > 2040 Then
 Text1.Height = Me.Height - 2040
 Text1.Top = 720
End If
If Me.Height > 1165 Then
 btnClear.Top = Me.Height - 1165
 btnCopy.Top = Me.Height - 1165
 btnExit.Top = Me.Height - 1165
End If
btnClear.Left = Text1.Left + 60
If Me.Width > (250 + btnExit.Width) Then
  btnExit.Left = Me.Width - 250 - btnExit.Width
End If
If Me.Width > btnCopy.Width Then
 btnCopy.Left = ((Me.Width - btnCopy.Width) / 2) + (0.002 * Me.Width)
End If
End Sub