home *** CD-ROM | disk | FTP | other *** search
/ High Voltage Shareware / high1.zip / high1 / DIR4 / V12N19.ZIP / FILCDR.ZIP / VBLOG.TXT < prev   
Text File  |  1993-07-02  |  4KB  |  105 lines

  1. VERSION 2.00
  2. Begin Form Form1 
  3.    Caption         =   "VB FileCdr Window"
  4.    ClientHeight    =   1935
  5.    ClientLeft      =   1095
  6.    ClientTop       =   1830
  7.    ClientWidth     =   7125
  8.    Height          =   2460
  9.    Icon            =   VBLOG.FRX:0000
  10.    Left            =   1035
  11.    LinkTopic       =   "Form1"
  12.    ScaleHeight     =   1935
  13.    ScaleWidth      =   7125
  14.    Top             =   1365
  15.    Width           =   7245
  16.    Begin Grid Grid1 
  17.       Cols            =   5
  18.       FixedCols       =   0
  19.       FixedRows       =   0
  20.       Height          =   615
  21.       HighLight       =   0   'False
  22.       Left            =   1920
  23.       Rows            =   1
  24.       TabIndex        =   1
  25.       Top             =   120
  26.       Width           =   2895
  27.    End
  28.    Begin TextBox Invisible_Text 
  29.       Height          =   615
  30.       Left            =   120
  31.       TabIndex        =   0
  32.       Text            =   "Invisible_Text"
  33.       Top             =   120
  34.       Visible         =   0   'False
  35.       Width           =   1455
  36.    End
  37. End
  38. ' declarations for access to FileCdrL DLL
  39. Declare Function FileCdrInstallVB% Lib "FILECDRL.DLL" (ByVal H%, ByVal TextH%)
  40. Declare Function FileCdrUnInstall% Lib "FILECDRL.DLL" (ByVal H%)
  41. ' declarations for Windows API functions
  42. Declare Function GetWinFlags& Lib "Kernel" ()
  43. Declare Function GetPrivateProfileString% Lib "Kernel" (ByVal lpApplicationName$, ByVal lpKeyName$, ByVal lpDefault$, ByVal lpReturnedString$, ByVal nSize%, ByVal lpFileName$)
  44. Declare Function WritePrivateProfileString% Lib "Kernel" (ByVal lpApplicationName$, ByVal lpKeyName$, ByVal lpstring$, ByVal lplFileName$)
  45. Declare Function ExitWindows% Lib "User" (ByVal dwReturnCode&, ByVal Reserved%)
  46. ' constants used by Windows API functions
  47. Const EW_RESTARTWINDOWS = &H42
  48. Const WF_ENHANCED = &H20
  49.  
  50. Dim Loaded%
  51.  
  52. Sub Form_Load ()
  53.   If GetWinFlags&() And WF_ENHANCED = 0 Then
  54.     MsgBox "Because Windows is not in 386 Enhanced mode, VBLog will not be able to log file events occurring in DOS boxes", MB_OK + MB_ICONINFORMATION, "VBLog Message"
  55.   Else
  56.     Valu$ = String$(20, 0)
  57.     Success% = GetPrivateProfileString("386Enh", "FileSysChange", "", Valu$, Len(Valu$), "SYSTEM.INI")
  58.     Valu$ = Left$(Valu$, Success%)
  59.     If Valu$ <> "ON" Then
  60.       If MsgBox("Windows is not set up to receive notification of file activity in DOS boxes.  Enable this feature and restart Windows?", MB_YESNO + MB_ICONQUESTION, "VBLog Message") = IDYES Then
  61.         Success% = WritePrivateProfileString("386Enh", "FileSysChange", "ON", "SYSTEM.INI")
  62.         If Success% Then Success% = ExitWindows(EW_RESTARTWINDOWS, 0)
  63.       End If
  64.     End If
  65.   End If
  66.   'set up the first four grid column widths
  67.   Grid1.ColWidth(0) = 1200
  68.   Grid1.ColWidth(1) = 1000
  69.   Grid1.ColWidth(2) = 400
  70.   Grid1.ColWidth(3) = 1800
  71.   ' first row initially NOT fixed, so we can use AddItem
  72.   Grid1.AddItem "Date" + Chr$(9) + "Time" + Chr$(9) + "OS" + Chr$(9) + "Event" + Chr$(9) + "File name(s)"
  73.   ' remove empty line
  74.   Grid1.RemoveItem 0
  75.   If FileCdrInstallVB(Form1.hWnd, Invisible_Text.hWnd) = 0 Then
  76.     MsgBox "Unable to install VB Log.  FileCDR is in use by another program - probably File Manager", MB_OK + MB_ICONINFORMATION, "VB Log Message"
  77.     Loaded% = False
  78.     Unload Form1
  79.   Else
  80.     Loaded% = True
  81.   End If
  82. End Sub
  83.  
  84. Sub Form_Resize ()
  85.   Grid1.Move 0, 0, ScaleWidth, ScaleHeight
  86.   Grid1.ColWidth(4) = ScaleWidth
  87. End Sub
  88.  
  89. Sub Form_Unload (Cancel As Integer)
  90.   If Loaded% Then
  91.     If FileCdrUnInstall(Form1.hWnd) = 0 Then
  92.       MsgBox "The FileCdr function could not be uninstalled.  You may have to restart Windows to regain access to FileCdr.", MB_OK + MB_ICONINFORMATION, "VB Log Message"
  93.     End If
  94.   End If
  95. End Sub
  96.  
  97. Sub Invisible_Text_Change ()
  98.   Grid1.AddItem Date$ + Chr$(9) + Time$ + Chr$(9) + Invisible_Text.Text
  99.   ' It is not possible for a grid to have just ONE row
  100.   ' and have that row be a fixed row.  Thus we do not
  101.   ' make it fixed until after another row has been added.
  102.   If Grid1.FixedRows = 0 Then Grid1.FixedRows = 1
  103. End Sub
  104.  
  105.