VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Begin VB.Form Logbook 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Session Logbook"
   ClientHeight    =   4995
   ClientLeft      =   2775
   ClientTop       =   2460
   ClientWidth     =   7500
   Icon            =   "Logbook.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   ScaleHeight     =   4995
   ScaleWidth      =   7500
   Begin VB.CommandButton Command3 
      Caption         =   "Help"
      Height          =   375
      Left            =   2400
      TabIndex        =   6
      ToolTipText     =   "Logbook help"
      Top             =   4440
      Width           =   855
   End
   Begin VB.FileListBox File1 
      Height          =   1650
      Left            =   120
      Pattern         =   "*.txt"
      TabIndex        =   5
      ToolTipText     =   "Stored log files"
      Top             =   2640
      Width           =   3135
   End
   Begin VB.CommandButton Command2 
      Caption         =   "Save Changes"
      Height          =   375
      Left            =   960
      TabIndex        =   4
      ToolTipText     =   "Save changes made to logbook"
      Top             =   4440
      Width           =   1335
   End
   Begin VB.CommandButton Command1 
      Caption         =   "OK"
      Height          =   375
      Left            =   120
      TabIndex        =   3
      Top             =   4440
      Width           =   735
   End
   Begin VB.TextBox Text1 
      Height          =   4215
      Left            =   3360
      MultiLine       =   -1  'True
      ScrollBars      =   3  'Both
      TabIndex        =   1
      ToolTipText     =   "Daily Log Entry"
      Top             =   480
      Width           =   3855
   End
   Begin MSComCtl2.MonthView MonthView1 
      Height          =   2370
      Left            =   120
      TabIndex        =   0
      ToolTipText     =   "Select a Day"
      Top             =   120
      Width           =   3075
      _ExtentX        =   5424
      _ExtentY        =   4180
      _Version        =   393216
      ForeColor       =   -2147483630
      BackColor       =   -2147483633
      Appearance      =   1
      ShowWeekNumbers =   -1  'True
      StartOfWeek     =   16187393
      CurrentDate     =   38037
      MaxDate         =   73415
      MinDate         =   18264
   End
   Begin VB.Label Label1 
      Alignment       =   2  'Center
      Caption         =   "Daily Log Entry"
      Height          =   375
      Left            =   3360
      TabIndex        =   2
      Top             =   120
      Width           =   3855
   End
End
Attribute VB_Name = "Logbook"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'Virtual Hypnotist
'©2003-2008 FollowTheWatch Software
'http://vhypno.sourceforge.net
'http://sourceforge.net/projects/vhypno
'Contact - followthewatch55@yahoo.com

'This program is free software; you can redistribute it and/or
'modify it under the terms of the GNU General Public License
'as published by the Free Software Foundation; either version 2
'of the License, or (at your option) any later version.

'This program is distributed in the hope that it will be useful,
'but WITHOUT ANY WARRANTY; without even the implied warranty of
'MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
'GNU General Public License for more details.

'You should have received a copy of the GNU General Public License
'along with this program; if not, write to the Free Software
'Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

Option Explicit
Dim File As String

Sub LoadFile(FileName As String)
Text1.Text = ""
Command2.Caption = "Save Changes"
Dim i As Integer
i = Len(Dir$(FileName))
If err Or i = 0 Then Exit Sub

Dim Temp As String
Dim Check As Boolean
Dim TempScript As String

    Temp = ""
    Open FileName For Input As #1
    TempScript = ""
    Do While Not EOF(1)
    Check = False
        Do
Before1:    If EOF(1) Then Exit Do
            DoEvents
            Temp = Input(1, #1)
            If Check = False And (Asc(Temp) = 13 Or Asc(Temp) = 10 Or EOF(1)) Then GoTo Before1 Else Check = True
            If Asc(Temp) = 13 Or Asc(Temp) = 10 Or EOF(1) Then Exit Do
            TempScript = TempScript + Temp
        Loop
    If EOF(1) = False Then TempScript = TempScript + vbCrLf
    If EOF(1) = True Then TempScript = TempScript + Temp
    Loop
Close #1

Text1.Text = TempScript
Command2.Caption = "Save Changes"

End Sub

Private Sub Command1_Click()
Logbook.Hide
End Sub

Private Sub Command2_Click()
File = App.path + "\logs\" + LTrim$(Str$(MonthView1.Month)) + "-" + LTrim$(Str$(MonthView1.Day)) + "-" + LTrim$(Str$(MonthView1.Year)) + ".txt"
Open File For Binary Access Write As #1
    Put #1, , Text1.Text
Close #1
Command2.Caption = "Save Changes"
End Sub

Private Sub Command3_Click()
If ExceptionHandlers = True Then On Error GoTo ErrorHandler

Shell "hh " + App.path + "\vh.chm::/logbook.html", vbNormalFocus
Exit Sub

ErrorHandler:
err.Source = "Logbook - Command3"
   Call ErrorReport("An error occurred while loading Windows HTML Help.", vbExclamation)
  
End Sub

Private Sub File1_DblClick()
Call LoadFile(App.path + "\logs\" + File1.FileName)
End Sub

Private Sub Form_Load()
MonthView1.value = Date
File1.path = App.path + "\logs"
Logbook.Left = (ScreenX / 2) - (Logbook.Width / 2)
Logbook.top = (ScreenY / 2) - (Logbook.Height / 2)
Call LoadFile(App.path + "\logs\" + LTrim$(Str$(MonthView1.Month)) + "-" + LTrim$(Str$(MonthView1.Day)) + "-" + LTrim$(Str$(MonthView1.Year)) + ".txt")
Me.Show
Command1.SetFocus
End Sub

Private Sub MonthView1_SelChange(ByVal StartDate As Date, ByVal EndDate As Date, Cancel As Boolean)
MonthView1.value = MonthView1.SelStart
Call LoadFile(App.path + "\logs\" + LTrim$(Str$(MonthView1.Month)) + "-" + LTrim$(Str$(MonthView1.Day)) + "-" + LTrim$(Str$(MonthView1.Year)) + ".txt")
End Sub

Private Sub Text1_Change()
Command2.Caption = "Save Changes*"
End Sub
