GFNoteWindow/GFNoteWindowfrm.frm
VERSION 5.00
Begin VB.Form GFNoteWindowfrm
Caption = "[...]"
ClientHeight = 3195
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
Enabled = 0 'False
Icon = "GFNoteWindowfrm.frx":0000
LinkTopic = "Form1"
MDIChild = ‑1 'True
Picture = "GFNoteWindowfrm.frx":058A
ScaleHeight = 3195
ScaleWidth = 4680
Visible = 0 'False
Begin VB.Timer GFNoteWindowNoteFileAutoSaveTimer
Enabled = 0 'False
Interval = 1000
Left = 4200
Top = 0
End
Begin VB.TextBox GFNoteWindowText
Height = 3015
Left = 0
MultiLine = ‑1 'True
ScrollBars = 2 'Vertikal
TabIndex = 0
Top = 0
Width = 4515
End
End
Attribute VB_Name = "GFNoteWindowfrm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
'(c)2001, 2002 by Louis. Can be inserted into any larger MDI project.
'
'THIS FORM IS PLUG‑IN CODE, DO NOT CHANGE!
'
'NOTE: If GFNoteWindow_NoteFile_AutoSave_Enable() was called
'then the note text will be saved in a certain time interval if
'GFNoteWindowfrm is enabled, visible and has the window state
'vbNormal or vbMaximized.
'If the window is closed (unloaded), the NoteFile will be saved
'automatically and the auto‑save timer will be disabled.
'
Dim GENoteWindowNoteFile As String
Private Sub Form_Load()
'on error resume next
Call DefineStatus
End Sub
Private Sub DefineStatus()
'on error resume next
'colors
'>>>change colors here<<<
'other
GFNoteWindowText.MaxLength = 32767 'important (avoid overflow)
End Sub
Private Sub Form_Resize()
'on error resume next
Dim Tempsngl!
GFNoteWindowfrm.ScaleMode = vbTwips
Tempsngl! = GFNoteWindowfrm.ScaleHeight
If Tempsngl! < 0 Then Tempsngl! = 0 'verify
GFNoteWindowText.Width = GFNoteWindowfrm.ScaleWidth
GFNoteWindowText.Height = Tempsngl!
GFNoteWindowText.Refresh
End Sub
Private Sub GFNoteWindowNoteFileAutoSave_Timer()
'on error resume next 'auto‑save NoteFile if enabled
If (GFNoteWindowfrm.Enabled = True) And (GFNoteWindowfrm.Visible = True) And _
((GFNoteWindowfrm.WindowState = vbNormal) Or (GFNoteWindowfrm.WindowState = vbMaximized)) Then
Call GFNoteWindow_NoteFile_Save
End If
End Sub
'************************************INTERFACE SUBS*************************************
Public Sub GENoteWindow_ReceiveNoteFile(ByVal NoteFilePassed As String)
'on error resume next
If Not (NoteFilePassed = "") Then
GENoteWindowNoteFile = NoteFilePassed
Else
MsgBox "internal error in GENoteWindow_ReceiveNoteFile(): passed value invalid !", vbOKOnly + vbExclamation
End If
End Sub
Public Function GFNoteWindow_NoteFile_Load() As Boolean
On Error GoTo Error: 'returns True if file has been loaded, False if not
Dim NoteFileFileNumber As Integer
Dim Tempstr$
NoteFileFileNumber = FreeFile(0)
'begin
If Not ((Dir(GENoteWindowNoteFile) = "") Or (Right(GENoteWindowNoteFile, 1) = "\") Or (GENoteWindowNoteFile = "")) Then 'verify
Open GENoteWindowNoteFile For Binary As #NoteFileFileNumber
If Not (LOF(NoteFileFileNumber) > 32767) Then
Tempstr$ = String(LOF(NoteFileFileNumber), Chr$(0)) 'initialize buffer
Else
Tempstr$ = String(32767, Chr$(0)) 'initialize buffer
End If
Get #NoteFileFileNumber, 1, Tempstr$
Close #NoteFileFileNumber
GFNoteWindowText.Text = Tempstr$
GFNoteWindow_NoteFile_Load = True 'ok
Else
GFNoteWindow_NoteFile_Load = False 'error
End If
Exit Function
Error:
Close #NoteFileFileNumber 'make sue file is closed
GFNoteWindow_NoteFile_Load = False 'error
Exit Function
End Function
Public Sub GFNoteWindow_NoteFile_AutoSave_Enable(ByVal UpdateTimeInMs As Single)
'on error resume next 'enable auto‑save timer
If Not (UpdateTimeInMs < 1000) Then 'verify
GFNoteWindowNoteFileAutoSaveTimer.Interval = UpdateTimeInMs
GFNoteWindowNoteFileAutoSaveTimer.Enabled = True
Else
MsgBox "internal error in GFNoteWindow_NoteFile_AutoSave_Enable(): passed value invalid !", vbOKOnly + vbExclamation
End If
End Sub
Public Sub GFNoteWindow_NoteFile_AutoSave_Disable()
'on error resume next 'disable auto‑save timer
GFNoteWindowNoteFileAutoSaveTimer.Enabled = False
End Sub
Public Function GFNoteWindow_NoteFile_Save() As Boolean
On Error GoTo Error: 'returns True if file has been saved, False if not
Dim NoteFileFileNumber As Integer
NoteFileFileNumber = FreeFile(0)
'begin
If Not (GENoteWindowNoteFile = "") Then 'verify
Open GENoteWindowNoteFile For Output As #NoteFileFileNumber
Print #NoteFileFileNumber, GFNoteWindowText.Text;
Close #NoteFileFileNumber
GFNoteWindow_NoteFile_Save = True 'ok
Else
GFNoteWindow_NoteFile_Save = False 'error
End If
Exit Function
Error:
Close #NoteFileFileNumber 'make sue file is closed
GFNoteWindow_NoteFile_Save = False 'error
Exit Function
End Function
Public Sub GFNoteWindow_SetFont(ByVal FontName As String, ByVal FontSize As Single)
On Error GoTo Error: 'important; change font of note text
GFNoteWindowText.Font.Name = FontName
GFNoteWindowText.Font.Size = FontSize
Exit Sub
Error:
'do nothing
Exit Sub
End Sub
Public Sub GFNoteWindow_SetCaption(ByVal CaptionPassed As String)
'on error resume next
GFNoteWindowfrm.Caption = CaptionPassed
End Sub
Public Sub GFNoteWindow_Show()
'on error resume next
GFNoteWindowfrm.Enabled = True
GFNoteWindowfrm.Visible = True
GFNoteWindowfrm.Refresh
End Sub
'*********************************END OF INTERFACE SUBS*********************************
Public Sub Form_Unload(Cancel As Integer)
'on error resume next
If Not (GENoteWindowNoteFile = "") Then 'verify
Call GFNoteWindow_NoteFile_AutoSave_Disable
Call GFNoteWindow_NoteFile_Save
End If
End Sub
[END OF FILE]