Is it possible to create a windows service in vb6? if yes,开发者_运维百科 how?
I've never tried it, but Desaware offer a commercial package, the NT Service Toolkit that claims to allow you to host a VB6 DLL inside a Windows Service. Desaware was founded (and I think is still owned by) VB6 guru Dan Appleman, which is a good recommendation.
Microsoft created a control to allow you to create services in VB6.
http://support.microsoft.com/default.aspx/kb/170883
http://support.microsoft.com/kb/175948/EN-US/
Yes, it works, is it the best way to create a service, no, but if VB6 is a requirement (you have a bunch of code you have to re-use), then I can state from experience that it works. We have the original control from the January 1997 MSDN, however you can easily find it on the net if need be ( http://www.google.ca/search?q=ntsvc.ocx+download )
Like gouging your own eyes out with a spoon, it is technically possible but I wouldn't recommend it.
Yes, you can. Just follow the directions in this tutorial:
http://www.vbrad.com/article.aspx?id=92
To answer your question, yes it is possible to create a Windows service with VB6. To offer you advice, there are much better tools to use. I did it once as a proof of concept project, but never liked it well enough to try to use it for anything that we used in the company. A co-worker did do this for a production app and it was error prone. After he left we found out just how hard he was working to keep his service running and ended up replacing his app without reviewing his code. So my advice is, if you want to do it as an exercise go ahead, but if you are looking at this for a workable solution you should consider other tools. Here is a link to one way to do it.
精彩评论