home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / axnteven / frwriter.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1999-03-29  |  4.3 KB  |  144 lines

  1. VERSION 5.00
  2. Object = "{97746B1E-E2AE-11D2-9A51-00000100C2E6}#1.0#0"; "AxEvntLg.ocx"
  3. Begin VB.Form FrmWriter 
  4.    Caption         =   "Event writer"
  5.    ClientHeight    =   3795
  6.    ClientLeft      =   60
  7.    ClientTop       =   345
  8.    ClientWidth     =   4590
  9.    LinkTopic       =   "Form1"
  10.    ScaleHeight     =   3795
  11.    ScaleWidth      =   4590
  12.    StartUpPosition =   3  'Windows Default
  13.    Begin AxEvntLg.AxNTEventLog NTEventLogX 
  14.       Left            =   1380
  15.       Top             =   1200
  16.       MachineName     =   ""
  17.       SourceName      =   "Application"
  18.       Active          =   0   'False
  19.       BackupFileName  =   ""
  20.       IncludeUserName =   -1  'True
  21.    End
  22.    Begin VB.CheckBox cbxInclude 
  23.       Caption         =   "Include User name"
  24.       Height          =   255
  25.       Left            =   1260
  26.       TabIndex        =   8
  27.       Top             =   2520
  28.       Width           =   2175
  29.    End
  30.    Begin VB.CommandButton btnFull 
  31.       Caption         =   "Write message"
  32.       Height          =   375
  33.       Left            =   60
  34.       TabIndex        =   7
  35.       Top             =   3360
  36.       Width           =   4455
  37.    End
  38.    Begin VB.CommandButton btnSimple 
  39.       Caption         =   "Write simple message"
  40.       Height          =   375
  41.       Left            =   60
  42.       TabIndex        =   6
  43.       Top             =   2880
  44.       Width           =   4455
  45.    End
  46.    Begin VB.ComboBox cmbEventType 
  47.       Height          =   315
  48.       Left            =   1260
  49.       Style           =   2  'Dropdown List
  50.       TabIndex        =   4
  51.       Top             =   2100
  52.       Width           =   3255
  53.    End
  54.    Begin VB.TextBox memStrings 
  55.       Height          =   1155
  56.       Left            =   60
  57.       MultiLine       =   -1  'True
  58.       TabIndex        =   3
  59.       Top             =   840
  60.       Width           =   4455
  61.    End
  62.    Begin VB.ComboBox cmbComputer 
  63.       Height          =   315
  64.       Left            =   1260
  65.       Style           =   2  'Dropdown List
  66.       TabIndex        =   0
  67.       Top             =   120
  68.       Width           =   3255
  69.    End
  70.    Begin VB.Label Label3 
  71.       Caption         =   "Event Type"
  72.       Height          =   255
  73.       Left            =   120
  74.       TabIndex        =   5
  75.       Top             =   2160
  76.       Width           =   915
  77.    End
  78.    Begin VB.Label Label2 
  79.       Caption         =   "Text to write"
  80.       Height          =   195
  81.       Left            =   120
  82.       TabIndex        =   2
  83.       Top             =   600
  84.       Width           =   975
  85.    End
  86.    Begin VB.Label Label1 
  87.       Caption         =   "Computer"
  88.       Height          =   255
  89.       Left            =   120
  90.       TabIndex        =   1
  91.       Top             =   180
  92.       Width           =   915
  93.    End
  94. Attribute VB_Name = "FrmWriter"
  95. Attribute VB_GlobalNameSpace = False
  96. Attribute VB_Creatable = False
  97. Attribute VB_PredeclaredId = True
  98. Attribute VB_Exposed = False
  99. Private Sub btnFull_Click()
  100.   NTEventLogX.MachineName = cmbComputer.Text
  101.   NTEventLogX.Active = True
  102.   EventType = 1
  103.   For i = 0 To cmbEventType.ListIndex - 1
  104.     EventType = EventType * 2
  105.   Next i
  106.   Set WriteObject = NTEventLogX.WriteObject
  107.   WriteObject.EventId = 1000
  108.   WriteObject.EventType = EVT_ERROR
  109.   WriteObject.EventCategory = 2
  110.   WriteObject.Strings.Text = memStrings.Text
  111.   WriteObject.DataBytes.Clear
  112.   For i = 0 To 3
  113.     WriteObject.DataBytes.Add (i)
  114.   Next i
  115.   Call NTEventLogX.AddObject(WriteObject)
  116.   NTEventLogX.Active = False
  117. End Sub
  118. Private Sub btnSimple_Click()
  119.   NTEventLogX.MachineName = cmbComputer.Text
  120.   NTEventLogX.Active = True
  121.   EventType = 1
  122.   For i = 0 To cmbEventType.ListIndex - 1
  123.     EventType = EventType * 2
  124.   Next i
  125.   Call NTEventLogX.Add(EventType, memStrings.Text)
  126.   NTEventLogX.Active = False
  127. End Sub
  128. Private Sub cbxInclude_Click()
  129.   NTEventLogX.IncludeUserName = Not (cbxInclude.Value = 0)
  130. End Sub
  131. Private Sub Form_Load()
  132.   Set List = NTEventLogX.GetServers("")
  133.   For i = 0 To List.Count - 1
  134.     cmbComputer.AddItem (List.Item(i))
  135.   Next i
  136. cmbEventType.AddItem ("SUCCESS")
  137. cmbEventType.AddItem ("ERROR")
  138. cmbEventType.AddItem ("WARNING")
  139. cmbEventType.AddItem ("Information")
  140. cmbEventType.AddItem ("AUDIT_SUCCESS")
  141. cmbEventType.AddItem ("AUDIT_FAILURE")
  142. cmbEventType.ListIndex = 0
  143. End Sub
  144.