|
[x]
Posted via EE Mobile
|
||
Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again. |
||
| Question |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: |
Imports Microsoft.VisualBasic
Imports System
Imports System.Collections
Imports System.ComponentModel
Imports System.Configuration
Imports System.Data
Imports System.Web.Services
Imports System.Diagnostics
Imports System.ServiceProcess
Imports System.IO
Namespace mcWebService
Public Class WinService1 : Inherits System.ServiceProcess.ServiceBase
Private oTimer As System.Threading.Timer
'Dim MyProcess As New Process
Dim strTimeTxt As String
Dim strFName As String
Private components As System.ComponentModel.Container
Public Sub New()
' This call is required by the WinForms Component Designer.
InitializeComponent()
' TODO: Add any initialization after the InitComponent call
End Sub
' The main entry point for the process
Shared Sub Main()
Dim ServicesToRun As System.ServiceProcess.ServiceBase()
' ServicesToRun = New System.ServiceProcess.ServiceBase[] {new WinService1(), new MySecondUserService()};
'
ServicesToRun = New System.ServiceProcess.ServiceBase() {New WinService1()}
System.ServiceProcess.ServiceBase.Run(ServicesToRun)
End Sub
Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container()
'@this.TrayAutoArrange = true;
'@this.TrayLargeIcon = false;
Me.ServiceName = "mcWinService"
End Sub
Protected Overrides Sub OnStart(ByVal args() As String)
' Add code here to start your service. This method should set things
' in motion so your service can do its work.
Dim oCallback As New Threading.TimerCallback(AddressOf OnTimedEvent)
oTimer = New System.Threading.Timer(oCallback, Nothing, 60000, 60000)
End Sub
Protected Overrides Sub OnStop()
' Add code here to perform any tear-down necessary to stop your service.
Dim objStreamWriter As System.IO.StreamWriter
Dim strFName As String
Dim dt2 As DateTime = DateTime.Now
strFName = "C:\VBScan\Log\mcWindowsService.txt"
If File.Exists(strFName) Then
Dim FILENAME As String = strFName
objStreamWriter = File.AppendText(FILENAME)
objStreamWriter.BaseStream.Seek(0, SeekOrigin.End)
objStreamWriter.WriteLine("VB_WinService: Service Started " & dt2)
objStreamWriter.Flush()
objStreamWriter.Close()
Else
objStreamWriter = File.CreateText(strFName)
objStreamWriter.BaseStream.Seek(0, SeekOrigin.End)
objStreamWriter.WriteLine("VB_WinService: Service Started " & dt2)
objStreamWriter.Flush()
objStreamWriter.Close()
End If
End Sub
Private Sub OnTimedEvent(ByVal state As Object)
Dim objStreamWriter As System.IO.StreamWriter
Dim dt1 As DateTime = DateTime.Now
strFName = "C:\VBScan\Log\VBSync.txt"
Dim p As New Process
Dim pi As New ProcessStartInfo("C:\Program Files\VBCC_Wireless\VBCC_WirelessInstaller\VBWS_Install.bat")
p.StartInfo = pi
p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
p.Start()
p.WaitForExit()
p.Close()
If File.Exists(strFName) Then
Dim FILENAME As String = strFName
objStreamWriter = File.AppendText(FILENAME)
objStreamWriter.BaseStream.Seek(0, SeekOrigin.End)
objStreamWriter.WriteLine("VB_WinService: Service Started " & dt1)
objStreamWriter.Flush()
objStreamWriter.Close()
Else
objStreamWriter = File.CreateText(strFName)
objStreamWriter.BaseStream.Seek(0, SeekOrigin.End)
objStreamWriter.WriteLine("VB_WinService: Service Started " & dt1)
objStreamWriter.Flush()
objStreamWriter.Close()
End If
Dim myLog As New EventLog
If Not Diagnostics.EventLog.SourceExists("VBWatcher") Then
Diagnostics.EventLog.CreateEventSource("VBWatcher", "VBWatcher Log")
End If
myLog.Source = "VBWatcher"
myLog.WriteEntry("Something Happened!", EventLogEntryType.Information)
End Sub
End Class
End Namespace
'bat file
"C:\Program Files\VBCC_Wireless\VBCC_WirelessInstaller\Window_DataAutomation.exe"
|
Advertisement
| Hall of Fame |