Click to See Complete Forum and Search --> : Services in VB, is it posssible ?


urosk
October 5th, 2001, 07:41 AM
I have to make service that will execute every day, like in 18:00 and perform some task.
Is it possible or can you point me to some documents.

Clearcode
October 5th, 2001, 07:45 AM
You could write a formless VB application (just a sub main) and run it using the NT scheduler.

e.g.
AT 18:00 /every:1234567 /interactive myexe.exe





-------------------------------------------------
Ex. Datis: Duncan Jones
Merrion Computing Ltd
http://www.merrioncomputing.com
Check out the new downloads - ImageMap.ocx is the VB control that emulates an HTML image map, EventVB.OCX for adding new events to your VB form and adding System Tray support simply, MCL Hotkey for implemenmting system-wide hotkeys in your application...all with source code included.

urosk
October 5th, 2001, 08:07 AM
That is OK idea, but what is happening if no user is logged.
Is is posssible to make real service ?

Asad Ullah
October 5th, 2001, 11:07 AM
hi,

The Windows NT version 4.0 resource kit provides a tool called SrvAny.exe for this purpose. This tool is actually a simple Windows NT service, which when started, spawns any regular Win32 application specified in its startup parameters. Please see SrvAny.wri in the Windows NT 4.0 resource kit for documentation of this tool.

Please note that spawning a process from a service is different from converting the process itself into a service. The latter may be the preferable option under certain circumstances (for example, if the process in question is an OLE server).


Another way is to use a third party active x control in your application which can make it a service.

urosk
October 8th, 2001, 03:03 AM
Thanks for answering,

I forgot to mention, that I am using W2K, any solution for this except scheduler ?

JHamilton
October 8th, 2001, 04:51 AM
http://msdn.microsoft.com/code/default.asp?url=/msdn-files/026/001/210/Windows%20NT%20Service%20Control/ntsrvocx_htm.asp

You need to install the NTSvc.ocx. I've heard it works well.

Cheers,

John

Software is like sex, it's better when it's free - Linus Torvalds
Software is like sex, it's better when I get paid for it. - me

urosk
October 8th, 2001, 06:33 AM
I tried it, it is working fine.

Thanks.