home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / webmon_1 / frmpopup.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1999-08-09  |  11.6 KB  |  292 lines

  1. VERSION 5.00
  2. Begin VB.Form frmPopups 
  3.    Caption         =   "Form1"
  4.    ClientHeight    =   3195
  5.    ClientLeft      =   3690
  6.    ClientTop       =   2910
  7.    ClientWidth     =   4680
  8.    LinkTopic       =   "Form1"
  9.    MousePointer    =   99  'Custom
  10.    ScaleHeight     =   3195
  11.    ScaleWidth      =   4680
  12.    Begin VB.Timer tmrEnd 
  13.       Enabled         =   0   'False
  14.       Interval        =   3000
  15.       Left            =   1800
  16.       Top             =   1320
  17.    End
  18.    Begin VB.Menu mnuMain 
  19.       Caption         =   "MainWeb"
  20.       Begin VB.Menu mnuPing 
  21.          Caption         =   "Ping Server"
  22.       End
  23.       Begin VB.Menu mnuRemserv 
  24.          Caption         =   "Remove Server"
  25.       End
  26.       Begin VB.Menu mnuEdit 
  27.          Caption         =   "Edit Server Properties.."
  28.       End
  29.       Begin VB.Menu mnuOpenWeb 
  30.          Caption         =   "Open Web Page"
  31.       End
  32.       Begin VB.Menu mnuCritical 
  33.          Caption         =   "Critical"
  34.          Begin VB.Menu mnuReboot 
  35.             Caption         =   "Reboot Server"
  36.          End
  37.          Begin VB.Menu mnuDead 
  38.             Caption         =   "Dead Server"
  39.          End
  40.       End
  41.    End
  42.    Begin VB.Menu mnuQuitMain 
  43.       Caption         =   "SysTray"
  44.       Begin VB.Menu mnuQuit 
  45.          Caption         =   "Quit Application"
  46.       End
  47.       Begin VB.Menu mnuSpeak 
  48.          Caption         =   "Speech"
  49.          Checked         =   -1  'True
  50.       End
  51.       Begin VB.Menu mnuShowLog 
  52.          Caption         =   "..Show Log"
  53.       End
  54.       Begin VB.Menu mnuToggle 
  55.          Caption         =   "Toggle"
  56.          Begin VB.Menu mnuShowGate 
  57.             Caption         =   "Show Gateway"
  58.          End
  59.          Begin VB.Menu mnuShowWeb 
  60.             Caption         =   "Show Web"
  61.          End
  62.          Begin VB.Menu mnuShowpollers 
  63.             Caption         =   "Show Pollers"
  64.          End
  65.       End
  66.    End
  67.    Begin VB.Menu mnuGateMain 
  68.       Caption         =   "MainGateWay"
  69.       Begin VB.Menu mnuGatePing 
  70.          Caption         =   "Ping Server"
  71.       End
  72.       Begin VB.Menu mnuRemGate 
  73.          Caption         =   "Remove Server"
  74.       End
  75.       Begin VB.Menu mnuEditGate 
  76.          Caption         =   "Edit Server Properties"
  77.       End
  78.       Begin VB.Menu mnuCriticalGate 
  79.          Caption         =   "Critical"
  80.          Begin VB.Menu mnuGateReBoot 
  81.             Caption         =   "Re Boot Server"
  82.          End
  83.          Begin VB.Menu mnuGateDie 
  84.             Caption         =   "dead Server"
  85.          End
  86.       End
  87.    End
  88. Attribute VB_Name = "frmPopups"
  89. Attribute VB_GlobalNameSpace = False
  90. Attribute VB_Creatable = False
  91. Attribute VB_PredeclaredId = True
  92. Attribute VB_Exposed = False
  93. Option Explicit
  94. Private Sub mnuDead_Click()
  95.     If blnRebooting(frmMain.intServClicked) = True Then
  96.         RebootPC LSetting("IP" & frmMain.intServClicked), False
  97.         blnRebooting(frmMain.intServClicked) = False
  98.     Else
  99.         If MsgBox("Are you sure you want to Die this server", vbOKCancel) = vbOK Then
  100.             If MsgBox("WARNING!!! This server will not restart and will have to be cycled manually" & vbCrLf & "Are you sure you wish to Die this server?", vbOKCancel) = vbOK Then
  101.                 RebootPC LSetting("IP" & frmMain.intServClicked), True, True
  102.                 blnRebooting(frmMain.intServClicked) = True
  103.                 SayThis "Warning! Killing server " & LSetting("MName" & frmMain.intServClicked) & " This server will not restart"
  104.                 LogIt ("Dead Server " & LSetting("MName" & frmMain.intServClicked) & " This server will not restart")
  105.             End If
  106.         End If
  107.     End If
  108. End Sub
  109. Private Sub mnuEdit_Click()
  110.     blnEdit = True
  111.     frmNewServer.Show
  112. End Sub
  113. Private Sub mnuEditGate_Click()
  114.     blnEdit = True
  115.     frmNewgateWay.Show
  116. End Sub
  117. Private Sub mnuGateDie_Click()
  118.     If blnRebooting(intGateClicked) = True Then
  119.         RebootPC LSetting("GateWayIP" & intGateClicked), False
  120.         blnRebooting(intGateClicked) = False
  121.     Else
  122.         If MsgBox("WARNING!!! This server will not restart and will have to be cycled manually" & vbCrLf & "Are you sure you wish to Die this server?", vbOKCancel) = vbOK Then
  123.                 RebootPC LSetting("gatewayIP" & intGateClicked), True, True
  124.                 blnRebooting(intGateClicked) = True
  125.                 SayThis "Warning! Killing server " & LSetting("GateWayName" & intGateClicked) & " This server will not restart"
  126.             End If
  127.     End If
  128. End Sub
  129. Private Sub mnuGatePing_Click()
  130. Dim ECHO As ICMP_ECHO_REPLY
  131.     FrmGateWay.lblBytesSent = ""
  132.     FrmGateWay.lblBytesRecieved = ""
  133.     FrmGateWay.lblTimeMS = ""
  134.     FrmGateWay.lblPingStatus.Caption = ""
  135.     FrmGateWay.lblPStats2.Caption = ""
  136.     FrmGateWay.lblPingStatus.Caption = "Pinging " & LSetting("GateWayIP" & intGateClicked) & _
  137.                     "with 9 bytes of Data................."
  138.     Call Ping(LSetting("GateWayIP" & intGateClicked), ECHO)
  139.         FrmGateWay.lblBytesSent = "9"
  140.         FrmGateWay.lblBytesRecieved = ECHO.DataSize
  141.         FrmGateWay.lblTimeMS = ECHO.RoundTripTime
  142.         FrmGateWay.lblPingStatus.Caption = GetStatusCode(ECHO.status)
  143.         Select Case Val(GetStatusCode(ECHO.status))
  144.             Case 0
  145.                 FrmGateWay.lblPStats2.Caption = "Successful ping to " & LSetting("GateWayIP" & intGateClicked)
  146.                 SayThis "Pinged the server " & LSetting("GateWayIP" & intGateClicked) & ". The ping was Successful"
  147.             Case Else
  148.                 SayThis "Couldn't Ping the server " & LSetting("IP" & intGateClicked) & ". The ping was UnSuccessful"
  149.                 FrmGateWay.lblPStats2.Caption = "Unable to ping " & LSetting("GateWayIP" & intGateClicked)
  150.         End Select
  151. End Sub
  152. Private Sub mnuGateReBoot_Click()
  153. If blnRebooting(intGateClicked) = True Then
  154.         RebootPC LSetting("GateWayIP" & intGateClicked), False
  155.         blnRebooting(intGateClicked) = False
  156.     Else
  157.         If MsgBox("Are you sure you want to reboot this server", vbOKCancel) = vbOK Then
  158.             RebootPC LSetting("gatewayIP" & intGateClicked), True
  159.             blnRebooting(intGateClicked) = True
  160.             SayThis "Warning! Rebooting server " & LSetting("GateWayName" & intGateClicked)
  161.         End If
  162.     End If
  163. End Sub
  164. Private Sub mnuOpenWeb_Click()
  165. If InStr(1, LSetting("URL" & frmMain.intServClicked), "http://") > 0 Then
  166.     Shell ("start " & LSetting("URL" & frmMain.intServClicked))
  167.     Shell ("start http://" & LSetting("URL" & frmMain.intServClicked))
  168. End If
  169. End Sub
  170. Private Sub mnuPing_Click()
  171.     Dim ECHO As ICMP_ECHO_REPLY
  172.     frmMain.lblBytesSent = ""
  173.     frmMain.lblBytesRecieved = ""
  174.     frmMain.lblTimeMS = ""
  175.     frmMain.lblPingStatus.Caption = ""
  176.     frmMain.lblPStats2.Caption = ""
  177.     frmMain.lblPingStatus.Caption = "Pinging " & LSetting("IP" & frmMain.intServClicked) & _
  178.                     "with 9 bytes of Data................."
  179.     Call Ping(LSetting("IP" & frmMain.intServClicked), ECHO)
  180.         frmMain.lblBytesSent = "9"
  181.         frmMain.lblBytesRecieved = ECHO.DataSize
  182.         frmMain.lblTimeMS = ECHO.RoundTripTime
  183.         frmMain.lblPingStatus.Caption = GetStatusCode(ECHO.status)
  184.         Select Case Val(GetStatusCode(ECHO.status))
  185.             Case 0
  186.                 frmMain.lblPStats2.Caption = "Successful ping to " & LSetting("IP" & frmMain.intServClicked)
  187.                 SayThis "Pinged the server " & LSetting("IP" & frmMain.intServClicked) & ". The ping was Successful"
  188.             Case Else
  189.                 SayThis "Couldn't Ping the server " & LSetting("IP" & frmMain.intServClicked) & ". The ping was UnSuccessful"
  190.                 frmMain.lblPStats2.Caption = "Unable to ping " & LSetting("IP" & frmMain.intServClicked)
  191.         End Select
  192.     End Sub
  193. Private Sub mnuQuit_Click()
  194.     If MsgBox("Are you sure you wish to exit ?", vbOKCancel, "Exit Confirm") = vbOK Then
  195.         FrmExit.Show
  196.         frmMain.inetWeb.Cancel
  197.         Unload frmMain
  198.         Unload FrmGateWay
  199.         tmrEnd.Enabled = True
  200.     End If
  201. End Sub
  202. Private Sub mnuReboot_Click()
  203.     If blnRebooting(frmMain.intServClicked) = True Then
  204.         RebootPC LSetting("IP" & frmMain.intServClicked), False
  205.         blnRebooting(frmMain.intServClicked) = False
  206.         LogIt ("Abort Reboot " & LSetting("MName" & frmMain.intServClicked))
  207.     Else
  208.         If MsgBox("Are you sure you want to reboot this server", vbOKCancel) = vbOK Then
  209.             RebootPC LSetting("IP" & frmMain.intServClicked), True
  210.             blnRebooting(frmMain.intServClicked) = True
  211.             SayThis "Warning! Rebooting server " & LSetting("MName" & frmMain.intServClicked)
  212.             LogIt ("Rebooting " & LSetting("MName" & frmMain.intServClicked))
  213.         End If
  214.     End If
  215. End Sub
  216. Private Sub mnuRemGate_Click()
  217.  Dim X As Integer
  218.     Dim strRemovedServer
  219.     If MsgBox("Are you sure you want to remove this server?", vbOKCancel, "Confirm Remove") = vbOK Then
  220.         strRemovedServer = LSetting("GateWayName" & intGateClicked)
  221.         For X = intGateClicked To intNoOfGateServers - 1
  222.             SSetting "gateDownSince" & X, LSetting("gateDownSince" & X + 1)
  223.             SSetting "GateWayIP" & X, LSetting("GateWayIP" & X + 1)
  224.             SSetting "LGateSend" & X, LSetting("LGateSend" & X + 1)
  225.             SSetting "LGateFail" & X, LSetting("LGateFail" & X + 1)
  226.             SSetting "GateWayName" & X, LSetting("GateWayName" & X + 1)
  227.             SSetting "GateWayPort" & X, LSetting("GateWayPort" & X + 1)
  228.         Next X
  229.         intNoOfGateServers = intNoOfGateServers - 1
  230.         SSetting "NoOfGateWays", intNoOfGateServers
  231.         modWeb.refresh
  232.         SayThis "Server " & strRemovedServer & " has been removed from the server list"
  233.     End If
  234. End Sub
  235. Private Sub mnuRemserv_Click()
  236.     Dim X As Integer
  237.     Dim strRemovedServer
  238.     If MsgBox("Are you sure you want to remove this server?", vbOKCancel, "Confirm Remove") = vbOK Then
  239.         strRemovedServer = LSetting("MName" & frmMain.intServClicked)
  240.         For X = frmMain.intServClicked To intNoOfServers - 1
  241.             SSetting "DownSince" & X, LSetting("DownSince" & X + 1)
  242.             SSetting "IP" & X, LSetting("IP" & X + 1)
  243.             SSetting "LCheck" & X, LSetting("LCheck" & X + 1)
  244.             SSetting "LFail" & X, LSetting("LFail" & X + 1)
  245.             SSetting "MName" & X, LSetting("MName" & X + 1)
  246.             SSetting "URL" & X, LSetting("URL" & X + 1)
  247.         Next X
  248.         intNoOfServers = intNoOfServers - 1
  249.         SSetting "NoOfServers", intNoOfServers
  250.         modWeb.refresh
  251.         SayThis "Server " & strRemovedServer & " has been removed from the server list"
  252.     End If
  253. End Sub
  254. Private Sub mnuShowGate_Click()
  255.     frmMain.Hide
  256.     Set CForm = FrmGateWay
  257.     SSetting "TOP", frmMain.Top
  258.     SSetting "LEFT", frmMain.Left
  259.     FrmGateWay.Show
  260. End Sub
  261. Private Sub mnuShowLog_Click()
  262. On Error GoTo open_log_error
  263. If Dir(App.Path & "\" & Format(Now, "dd mmm yyyy") & ".txt") <> "" Then
  264.     Shell ("Notepad " & App.Path & "\" & Format(Now, "dd mmm yyyy") & ".txt"), vbNormalFocus
  265.     MsgBox "No logs found", vbExclamation
  266. End If
  267. Exit Sub
  268. open_log_error:
  269.     MsgBox Err.Description, vbExclamation
  270. End Sub
  271. Private Sub mnuShowpollers_Click()
  272.     MsgBox ("Pollers not supported in this beta version")
  273. End Sub
  274. Private Sub mnuShowWeb_Click()
  275.     CForm.Hide
  276.     Set CForm = frmMain
  277.     frmMain.Show
  278. End Sub
  279. Private Sub mnuSpeak_Click()
  280.     If mnuSpeak.Checked = False Then
  281.         mnuSpeak.Checked = True
  282.     ElseIf mnuSpeak.Checked = True Then
  283.         mnuSpeak.Checked = False
  284.     End If
  285. End Sub
  286. Private Sub tmrEnd_Timer()
  287.         tmrEnd.Enabled = False
  288.         FrmExit.Timer1.Enabled = False
  289.         Unload Me
  290.         End
  291. End Sub
  292.