|
[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: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142: 143: 144: 145: 146: 147: 148: 149: 150: 151: 152: 153: 154: 155: 156: 157: 158: 159: 160: 161: |
'Web Service.vb
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
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()
' More than one user Service may run within the same process. To add
' another service to this process, change the following line to
' create a second service object. For example,
'
' 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 objStreamWriter As System.IO.StreamWriter
Dim strFName As String
Dim oCallback As New Threading.TimerCallback(AddressOf OnTimedEvent)
oTimer = New System.Threading.Timer(oCallback, Nothing, 6000, 6000)
MyProcess.StartInfo.FileName = "C:\Program Files\VBCC_Wireless\VBCC_WirelessInstaller\Window_DataAutomation.exe"
MyProcess.StartInfo.CreateNoWindow = True
MyProcess.Start()
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 " & Constants.vbLf)
objStreamWriter.Flush()
objStreamWriter.Close()
Else
objStreamWriter = File.CreateText(strFName)
objStreamWriter.BaseStream.Seek(0, SeekOrigin.End)
objStreamWriter.WriteLine(" VB_WinService: Service Started " & Constants.vbLf)
objStreamWriter.Flush()
objStreamWriter.Close()
End If
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
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 " & Constants.vbLf)
objStreamWriter.Flush()
objStreamWriter.Close()
Else
objStreamWriter = File.CreateText(strFName)
objStreamWriter.BaseStream.Seek(0, SeekOrigin.End)
objStreamWriter.WriteLine(" VB_WinService: Service Started " & Constants.vbLf)
objStreamWriter.Flush()
objStreamWriter.Close()
End If
End Sub
Private Sub OnTimedEvent(ByVal state As Object)
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
'ServerProcessInstaller1
Imports Microsoft.VisualBasic
Imports System
Imports System.Collections
Imports System.ComponentModel
Imports System.Configuration.Install
Namespace mcWebService
' using System.Core;
''' <summary>
''' Summary description for ProjectInstaller.
''' </summary>
<RunInstaller(True)> _
Public Class ProjectInstaller : Inherits System.Configuration.Install.Installer
''' <summary>
''' Required designer variable.
''' </summary>
Private components As System.ComponentModel.Container
Private serviceInstaller1 As System.ServiceProcess.ServiceInstaller
Private serviceProcessInstaller1 As System.ServiceProcess.ServiceProcessInstaller
Public Sub New()
' This call is required by the Designer.
InitializeComponent()
' TODO: Add any initialization after the InitComponent call
End Sub
Private Sub InitializeComponent()
Me.serviceInstaller1 = New System.ServiceProcess.ServiceInstaller
Me.serviceProcessInstaller1 = New System.ServiceProcess.ServiceProcessInstaller
'
'serviceInstaller1
'
Me.serviceInstaller1.ServiceName = "mcWinService"
'
'serviceProcessInstaller1
'
Me.serviceProcessInstaller1.Password = Nothing
Me.serviceProcessInstaller1.Username = Nothing
'
'ProjectInstaller
'
Me.Installers.AddRange(New System.Configuration.Install.Installer() {Me.serviceProcessInstaller1, Me.serviceInstaller1})
End Sub
End Class
End NameSpace
I Also Have a Custome Action which run the primary output file
|
Advertisement
| Hall of Fame |