|
Hello to all.
My problem is this,
i have to control if a service is up/down on my pc.
for example ssl connection.
I made my program(service) to see if the service (ssl connection) is up/down and if is down, start the ssl connection.
You can see the code here...
Imports System.ServiceProcess
Imports System.IO ' Utilizacao de escrita/leitura de ficheiros
Public Class KeepingServiceAlive
Inherits System.ServiceProcess.ServiceBase
' Definir o serviço a controlar
' Para experiência vamos utilizar o SSL de HTTP
Dim ServicoControlo As New ServiceController("SSL de HTTP")
#Region " Component Designer generated code "
Public Sub New()
MyBase.New()
' This call is required by the Component Designer.
InitializeComponent()
' Add any initialization after the InitializeComponent() call
End Sub
'UserService overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
' The main entry point for the process
<mtathread()> _
Shared Sub Main()
Dim ServicesToRun() As System.ServiceProcess.ServiceBase
' More than one NT 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 Service1, New MySecondUserService}
'
ServicesToRun = New System.ServiceProcess.ServiceBase() {New KeepingServiceAlive}
System.ServiceProcess.ServiceBase.Run(ServicesToRun)
End Sub
'Required by the Component Designer
Private components As System.ComponentModel.IContainer
' NOTE: The following procedure is required by the Component Designer
' It can be modified using the Component Designer.
' Do not modify it using the code editor.
Friend WithEvents tmrWatchService As System.Timers.Timer
<system.diagnostics.debuggerstepthrough()> Private Sub InitializeComponent()
Me.tmrWatchService = New System.Timers.Timer
CType(Me.tmrWatchService, System.ComponentModel.ISupportInitialize).BeginInit()
'
'tmrWatchService
'
Me.tmrWatchService.Enabled = True
Me.tmrWatchService.Interval = 5000
'
'KeepingServiceAlive
'
Me.ServiceName = "KeepingServiceAlive"
CType(Me.tmrWatchService, System.ComponentModel.ISupportInitialize).EndInit()
End Sub
#End Region
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.
End Sub
Protected Overrides Sub OnStop()
' Add code here to perform any tear-down necessary to stop your service.
End Sub
Private Sub tmrWatchService_Elapsed(ByVal sender As System.Object, ByVal e As System.Timers.ElapsedEventArgs) Handles tmrWatchService.Elapsed
Dim ficheiro As TextWriter
' ServicoControlo.Refresh()
If ServicoControlo.Status = ServiceControllerStatus.Running Then
ficheiro = New StreamWriter("C:\sacor.txt", True)
ficheiro.WriteLine("Service is running... ")
ficheiro.Close()
Else
Try
ficheiro = New StreamWriter("C:\sacor.txt", True)
ServicoControlo.Start()
ficheiro.WriteLine("Service started")
ServicoControlo.Refresh()
ficheiro.Close()
Catch ex As Exception
ficheiro = New StreamWriter("C:\sacor.txt", True)
ficheiro.WriteLine("Can't start ssl connetion service")
ficheiro.Close()
End Try
End If
End Sub
End Class
The problem is that sometimes work and others don't
thanks for your time
|
|
|
|
|
I am making a wild guess here....
There are 2 possibilites with your service,
1. It's started
2. It's stopped
In the first case it might be possible that the service hasnt completly stopped yet so it cant start itself since its still running.
In the Second Case if u start the service it surely will since currently its stopped.
Hopefully it helps
Life Is A Cipher Substituting "happiness" with "sadness" and Transforming "pleasure" into "pain"
|
|
|
|
|
Why don't you just configure the service recovery options? When you double-click on the SSL service in the services management console, there is a tab called "recovery". You can configure the service to restart on failure. Sounds like you have a problem though if SSL is failing so often that you need to keep restarting.
|
|
|
|
|
Hi,
I am getting "InvalidOperation" exception when using the June- Enterprise library blocks for Data access in VB.NET 2005. The same code works fine in 1.1 framework. Though I copied the dataconfiguration config file to Debug folder, its still showing error at DatabaseFactory.CreateDatabase()line. Please help.
regards,
Jasmin
|
|
|
|
|
I would like to determine whether the current user is Authenticated against the network domain or not. I am using VB6 SP5. Can anyone help ??
|
|
|
|
|
Hello All,
I am working on a collge project with VB.NET and trying to make something similar to Remote Desktop available in Windows XP.
I tried using Windows Media Encoder SDK to capture the screen activities as video(not good quality) but its a CPU hogger and the processing goes upto 95% making it virutally impossible to do any other active process on the remote machine.
Is there a soln that can help me capture and broadcast live to the client at the other end?
Also i installed DirectX 9.0c SDK to play video files using the DirectAudioVideo class and the problem is that i need to capture key and mouse events on the video window.
I used a list box to render the output of the video file, suprisingly when i play the video in full screen mode it captures the mouse and key events but if its not a full screen mode all the events are ignored, why is that happenning?
Thanks for reading.
Life Is A Cipher Substituting "happiness" with "sadness" and Transforming "pleasure" into "pain"
|
|
|
|
|
Google for "VNC" and you'll find what you're looking for.
Forget using the Media Encoder for this. It's too slow, a CPU hog (as you've found), generates low quality, and is not designed for this application.
telophase wrote:
I used a list box to render the output of the video file
LISTBOX? Why?
Anyway, search for VNC and you'll find that you've been doing this the hard way.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Yes i know what a VNC is and what it can be used for but i dont want to use a ready made software.
I am doing the above mentioned as project in my college and i need to submit code there
So i need to "write" my own version of VNC in any programming language possible.
Any further help appreciated
Life Is A Cipher Substituting "happiness" with "sadness" and Transforming "pleasure" into "pain"
|
|
|
|
|
Then, I suggest looking at existing open source projects so you at least know what you're getting yourself into. It's not as easy as you might think and there is WAY too much to explain in a forum environment. Results...[^]
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
hey does anyone know the largest size instance of TSP that has been solved to date and what method does the solution use
-- modified at 0:09 Monday 3rd October, 2005
|
|
|
|
|
Ever hear of Google? Try searching for "TSP Largest Solved"[^]
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I am writing a program that needs to launch another program, log in, run another program, and then type in some text or make selections in a list box. I've figured out how to launch the app and get's it's window handle but that's it. I'm at a loss as to how to find the resulting window and send clicks, keystrokes, or whatever. Worse, after intially launching the first app (Citrix, if your are curious), I will be presented with a login screen, a folder with several icons one of which will need to be launched, another login screen, another virtual folder with an app that needs to be run, etc.
So what is the best way to approach this? I've been reading up on the Windows API...
This is frustrating because at home I often use a program called Macro Express to automate this sort of thing.
|
|
|
|
|
It's been a while, but I think you want to look at the sendmessagee function in the win32 api.
|
|
|
|
|
Well you could use EnumWindows to get the list of all top level windows.
Then you could use EnumChildWindows to get the list of the child compoments inside the parent.
Since you are posting this in VB section i am asuming that you are using VB, then you can use AppActivate to set focus on the window and then SendKeys to send the keys to the window
To run an application you can use the Shell function which returns the process id if the program is running.
-------------------------------------------
Taken From MSDN 2003
-------------------------------------------
'Example
AppActivate("Untitled - Notepad")
SendKeys.SendWait("Hello world!")
' Send Ctrl S to open the Save As dialog box.
SendKeys.SendWait("^S")
' Send the name of the new file.
SendKeys.SendWait("c:\HelloWorld.txt")
' Send Alt S to save the file.
SendKeys.SendWait("%S")
-------------------------------------------
I hope the above helps
Life Is A Cipher Substituting "happiness" with "sadness" and Transforming "pleasure" into "pain"
|
|
|
|
|
SendKeys!! Thats what I was thinking of...
|
|
|
|
|
Yes that does help, thanks. I guess I just need to take them on one by one and see what works by trial and error.
|
|
|
|
|
Hi all
I have this project im converting from vb6 to vb.net
when i run the code advisor for vb6 it keep getting this fixit code.
'FIXIT: Declare 'currentdate' and 'tempDay' and 'tempMonth' with an early-bound data type FixIT90210ae-R1672-R1B8ZE
Dim currentdate, tempDay, tempMonth, tempYear As String
Dim tempDate As String
I go to the help file for this fixit but it does not explane it very well. Can any one explane it to me.
The Dim statements are my original code.
Ed
|
|
|
|
|
Declaring multiple variables with a single "Dim" strongly types only the variables with an "As" clause. So your first declaration declares three variants in VB6 and one string.
You get the message when upgrading since you *may* want to keep it as three objects and one string (the original intent of the VB6 code) - or more likely you originally intended four strings - VB.NET would regard it as four strings.
David Anton
www.tangiblesoftwaresolutions.com
Instant C#: VB.NET to C# Converter
Instant VB: C# to VB.NET Converter
Instant C++: C# to C++ Converter
Instant J#: VB.NET to J# Converter
Clear VB: Cleans up outdated VB.NET code
|
|
|
|
|
Of course, I meant:
Declaring multiple variables with a single "Dim" strongly types only the variables with an "As" clause ***IN VB6***
David Anton
www.tangiblesoftwaresolutions.com
Instant C#: VB.NET to C# Converter
Instant VB: C# to VB.NET Converter
Instant C++: C# to C++ Converter
Instant J#: VB.NET to J# Converter
Clear VB: Cleans up outdated VB.NET code
|
|
|
|
|
|
:Nuke: Goodbye world!
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
//Crystal Report Object
CrystalReport2 cp = new CrystalReport2();
CReport cp1 = new CReport();
//Form Load Event
private void Form2_Load(object sender, System.EventArgs e)
{
crystalReportViewer1.ReportSource = cp;
}
//Link Label Click Event
private void linkLabel1_LinkClicked(object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e)
{
try
{
string empid = textBox1.Text.Trim();// H-B39728F employee id
SqlConnection con = new SqlConnection("server=SK-WAQAS;uid=sa;pwd=Butt;database=pubs");
SqlDataAdapter daemp = new SqlDataAdapter("Select * From employee where emp_id= '" + empid + "'", con);
DataSet ds = new DataSet();
daemp.Fill(ds,"employee");
cp.SetDataSource(ds);
con.Close();
}
catch(Exception ce)
{
MessageBox.Show(ce.Message);
}
}
// End Code
When i run this code no record show in Crystal Report. Please tell me where is do mistake. I want to show record in crystal report on the base of emp_id , i use pubs database on Sql server 2000.
Thanks in advance.
|Muhamad Waqas Butt|
waqasb4all@yahoo.com
www.sktech.freewebspace.com
|
|
|
|
|
I am developing a video conferencing program. It is intended to work on internet. I used AVICAP to capture video from webcam. The method i intended to used to stream video is capture a frame from webcam then send it over to the other PC and then repeat it again. The other PC will paste the frame received to the picture box upon receive the bmp file. My problem is I do not know i should choose either TCP/IP, UDP or socket as my connection method? And i do not know how to stream audio captured across internet. Can any1 give some help here either by giving me some sample video conferencing program (vb.Net) or giving some guildance and tutorial ?
-- modified at 2:43 Sunday 2nd October, 2005
|
|
|
|
|
|
See here[^]!
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|