I have created a service successfully and the executable I am
binding to it is also compiled from VB. So, program "A" is the one
creating the service and program "B" is the program that is run
as a service. My issue is that program "A" always comes back
with an error when I try to Start the service from the program.
If I manually run the service it gives the error that "The program
did not resopond in a timely fashion.
What are the requirements for a program to run as a service? Am
I missing a callback procedure or something in the service exe?
Service program "B" seems to run though because it is outputing
a textfile detecting the platform and version correctly. Nothing
fancy. I want to add more , but I am not sure what is missing.
Thanks for any input.
Last edited by RobDog888; Jun 11th, 2004 at 12:37 PM.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
Yes, I have that control from M$ its the NTSRV.ocx control. I
wanted to try to stay away from depending on it since M$ doesn't
support it. Don't want to create any issues on our servers. So I
created the service entirely with APIs. Not really too hard after
you know how. The issue is that my program is not responding
back to the Service Manager with a response of either successful
start or failure to start within the 30 second time out.
The reason for all of this is that I need to get a list of the Local
Fixed Disks on a remote server that I have Domain Admins
priviliages. Since that APIs to get the drives only works for the
local system its being run from, if I was to run it from my
workstation it will list my drives and not the target server drives.
So, I created this service remotely on the target server and the
exe that is bound to the service is copied over to list the drives.
I also want to run a bat file from the service to get the
defragmentation analysis of the server. I know how to do this
that is why I need the list of drives. It also detects the platform
and version to see if it is supported or not. Defrag.exe is only
supported under Windows XP and Server 2003 and above.
I can do all of these if only I can get the service to successfully
start.
Thanks for reading this looong explanation.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
Thanks RhinoBull, but @$995 for the OEM commercial
redistributable version, too much money.
I need to find a solution to this issue soon. I need to be able to
create a vb program that can be run as a service. I already have
the other part finished where I create the service and bind an
exe to the service. What do I need in the exe to communicate
with the service manager to let it know that the service started
or not. I keep getting the error that - "Could not start service on
local computer. Error: 1053: The service did not respond to the
start or control request in a timely fashion." But it actuall did start.
I dont know if the sm closes the program because as of now it is
only doing a small number of tasks and ending or if the sm is
closing it.
This is an example of a binded exe that I need to create.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
YES, this is exactly what I was missing! Thanks allot RhinoBull.
I knew there was a procedure for handeling communications back
to the service manager. Also, found the procedure for passing
arguments to the service! Now I just need to incorporate it into
my service program.
Just a sample of what was missing...
VB Code:
Private Sub ServiceMain(ByVal dwArgc As Long, ByVal lpszArgv As Long)
One other thing, the service program example contains a
reference to a typelibrary file and some .odl files. I don't want to
have to rely on these in my program. At initial look, it seems that
they are just holding all the APs and type structures for simplicity.
Does this look like a correct assumption to you too?
Thanks
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum.