COM object as NT Service

I have a COM object that reads a directory for a specific file and if it finds one, it is to copy it from one folder to another.
I want this COM object to a be an NT Service that runs every 10 minutes....how can I make this COM object an NT Service so it runs in the background...like other Services on a machine?
lobosAsked:
Who is Participating?
 
mdouganConnect With a Mentor Commented:
srauda,

That is exactly what the srvany.exe does that you can download for free from the links I provided above.  The links also provide sample VB source, including some important tips on code necessary for cleanly terminating the service when the user stops the service using the Service control manager.

Why pay for something from Desaware when you can get it for free?
0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
I would write a small VB app that runs as a service, and that calls this COM object.
* to run every 10 minutes: use a timer control or a API, as you like
* to run as service: use the ntsvc.ocx, or some utility to transform your application into a service.


Note:
  For simplicity, you might use the timer control and the ntsvc control on the same form, the utility to transform your application makes it more difficult in your code to handle the different events send from the services applet...

CHeers
0
 
mdouganCommented:
Well, VB executables don't really have the proper interface to be installed as services by themselves.

What you need to do is download this C program that can act as a "proxy" for your VB program.  So, the C program is actually the one that runs as the NT Service, but when it starts up, you give it some start-up parameters to start-up your VB program.

This program was available on the MSDN disks.... let me see if I can find in out there.....

Here is one of the links that I used:

http://www.geocities.com/SiliconValley/Pines/3991/nthowto.htm

Here is the other one I think:

http://vbwire.com/advanced/howto/service.asp

Good Luck!
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
sraudaCommented:
I believe the NT Service Toolkit by Desaware is exactly what you are looking for.  I have used it and it works very nicely and is very reliable.

This toolkit allows you to create an ActiveX Dll that is linked to an exe created by the toolkit.  The exe runs as the service and calls your dll for running the tasks you require.  The exe hides all the complexities required for creating a service.

Check it out at www.desaware.com
0
 
sraudaCommented:
mdougan,

the srvany.exe is not as stable.

0
 
sraudaCommented:
Plus, you cannot handle events passed on by the service control manager if necessary.
0
 
lobosAuthor Commented:
I would like to avoid including other vendors for anything.
0
 
sraudaCommented:
then mdougan has the right solution.

another solution would be to include the COM in a standard exe.  Then have the Microsoft Task Scheduler run the exe every ten minutes.
0
 
mdouganCommented:
I never had any trouble with srvany.exe.  

I'm not sure what you mean by events.  srvany handles the user starting or stoping the service from the service control manager (and as far as I know, anthing else you can do in the service control manager), all you have to do is put code in your vb component for when those events are relayed to your app from srvany.
0
 
sraudaCommented:
In the desaware toolkit, have a scm object reference that you can use to respond to start and stop events as well as user control events.

I never saw how my vb code could respond to srvany.  As far as I saw, srvany would be responsible for launching and terminating your executable.  In fact, your program had to be an executable.

Maybe I am mistaken, but that was how I saw it.

0
 
MoondancerCommented:
I'll return shortly, but since I've asked Administration to contact lobos, wanted to include this first.

Question(s) below appears to have been abandoned. Your options are:
 
1. Accept a Comment As Answer (use the button next to the Expert's name).
2. Close the question if the information was not useful to you. You must tell the participants why you wish to do this, and allow for Expert response.
3. Ask Community Support to help split points between participating experts, or just comment here with details and we'll respond with the process.
4. Delete the question. Again, please comment to advise the other participants why you wish to do this.

For special handling needs, please post a zero point question in the link below and include the question QID/link(s) that it regards.
http://www.experts-exchange.com/jsp/qList.jsp?ta=commspt
 
Please click the Help Desk link on the left for Member Guidelines, Member Agreement and the Question/Answer process.  http://www.experts-exchange.com/jsp/cmtyHelpDesk.jsp

Please click you Member Profile to view your question history and keep them all current with updates as the collaboration effort continues, to track all your open and locked questions at this site.  If you are an EE Pro user, use the Power Search option to find them.

To view your open questions, please click the following link(s) and keep them all current with updates.
http://www.experts-exchange.com/questions/Q.20258729.html
http://www.experts-exchange.com/questions/Q.20269575.html
http://www.experts-exchange.com/questions/Q.20273076.html

PLEASE DO NOT AWARD THE POINTS TO ME.  
 
------------>  EXPERTS:  Please leave any comments regarding your closing recommendations if this item remains inactive another seven (7) days.  Also, if you are interested in the cleanup effort, please click this link, entitled EXPERTS WHO ARE TIRED OF ABANDONED QUESTIONS CAN HELP"  ... http://www.experts-exchange.com/jsp/qManageQuestion.jsp?ta=commspt&qid=20274643

Thank you everyone.
Moondancer
Moderator @ Experts Exchange
0
 
MoondancerCommented:
A "C" grade without even a comment as to why?  Please do make a comment to tell us why.  This not only helps the experts here understand, but also future people who visit this item in our PAQ for help.  If you've found more in this regard, please add it. If the grade was given in error, let us know, we can correct.

The points to you are the same, but the expert points which flow depend on the grade.

Thanks,
Moondancer - EE Moderator
0
 
MoondancerCommented:
After re-reading this the 3rd time and still no response, feel that an A is in order and changed it accordingly.
Moondancer - EE Moderator
0
 
mdouganCommented:
Thanks!  I can't understand a "C" either, he got more than enough information to answer his original question.
0
 
lobosAuthor Commented:
I applogize, it was an error and it should have been corrected, thanks for changing it for me.
Thanks again.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.