Lee W, MVP
asked on
Shell & Service Issues
First, I'm not a programmer - I dabble and know a bit (DLL calls I do NOT know).
Trying to write a program that monitors services under NT.
In order to verify that the service exists and/or is running, I was going to use a shell command and redirect the output to a file - open that file and parse the information. Problem is, the NET START <service> command will not redirect to a file. So I need an alternate way of doing this - simple DLL calls (well detailed in any perspective answer), another way of reading the result of information from the shell, whatever. The following is more or less how I was intending to do this, assuming the redirection worked:
shell "net start " + ServiceName + " > ~svcchk.tmp"
open "~svcchk.tmp" for input as #1
line input #1, StartServiceResult
If instr(StartServiceResult, <string>) then
else
end if
Trying to write a program that monitors services under NT.
In order to verify that the service exists and/or is running, I was going to use a shell command and redirect the output to a file - open that file and parse the information. Problem is, the NET START <service> command will not redirect to a file. So I need an alternate way of doing this - simple DLL calls (well detailed in any perspective answer), another way of reading the result of information from the shell, whatever. The following is more or less how I was intending to do this, assuming the redirection worked:
shell "net start " + ServiceName + " > ~svcchk.tmp"
open "~svcchk.tmp" for input as #1
line input #1, StartServiceResult
If instr(StartServiceResult, <string>) then
else
end if
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I'm afraid the human brain is the source.
But how difficult can it be:
vbStartService
ServiceStatus
vbPauseService
vbStopService
The parameters are always computername, servicename
But how difficult can it be:
vbStartService
ServiceStatus
vbPauseService
vbStopService
The parameters are always computername, servicename
ASKER
Ok... acceptible... though I did have some initial problems (vb6) having the constants as public - I had to remove the public portion of those statements and it worked. Though I suppose it could just have something to do with how I had things. I got it working though (or so it would seem) - but it doesn't seem to work with the SERVER or WORKSTATION services (I'll need to do a bit of further testing - I'm also running vb6 on win2k). I'm going to delay answering the question just yet - you'll get the points at either an A or B grade, depending on how easily I figure out the rest of it (I think it'll be ok, but just want to check).
That's because it's a module not a form. Forms don't allow public constants and declarations.
ASKER