Is that possible in vb6 in windows 7? I know it was possible in Windows NT.
Printable View
Is that possible in vb6 in windows 7? I know it was possible in Windows NT.
Of course it is possible i think.
Let me know it you need anything like a setup or something.
Historically there were two main ways to do this.
One was a "quick and dirty" approach with some severe limitations, using a utility called srvany that came from one of the Resource Kits (NT 4.0? Win2k?). This is a wrapper process that becomes the actual Service but kicks off a VB6, etc. EXE as a child process in the Service context.
The other was a C++ OCX called ntsvc.ocx that could be added to the main Form of a carefully-written VB6 program. It provides the necessary Service Manager and related interfaces a Service must support. Microsoft never offered it except as C++ source because it was unsupported. There are precompiled versions of the code around, some strictly VB5-oriented and some better-bahaved modified versions for VB6. There are also some creaky/broken versions out there.
Using these two Microsoft approaches (or several 3rd party approaches) your programs need to be carefully crafted to operate properly as a Service. In the post-XP world even more care is required because modern versions of Windows lock down a lot more things. Look up "Windows Service Hardening."
This isn't something the shadetree coder will be able to pick up and run with from sample code snippets. It is fairly exotic and requires very good understanding of how VB6 really works, Apartment Threading details, etc. There are many things that have to be dealt with in order for such a program to be reliable. There are also special deployment considerations.
Often you don't really need a Service anyway.
Sometimes you can get by fine with a regular program that is auto-run via the Startup folder. If you insist you can also use the various auto-run registry keys.
Modern Windows versions also have an enhanced Scheduler that can be used to run a program on logon or even on boot (with nobody logging on).
The last scenario is really the only one that normally needs a Service anyway: a program that always runs after booting.
The real question is: Why do you think you want a Service? This might be rephrased as: What are you actually trying to accomplish?
hmmmmm you scarred me from even trying it....
bytheway my prog is a lil fun thing which i want to play with my friends, you can call it a trojan. but it won't steal their bank accounts etc just funny pranks ;)
Malwares are always malwares and will never be anything but malwares even if it's just installed on your friends computers as a "funny" prank.
I think your question about running a VB6 application as a service has been answered, with the possible exception that it's hard to play a "funny prank" on someone if you're service aren't allowed to access the users desktop.
This thread is now officially closed!