By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,729 Members | 1,167 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,729 IT Pros & Developers. It's quick & easy.

Create a "Service"???

P: n/a
I've an application in which I use to check out the date/time stamp of a data
base... and if I find that it has been updated, my application runs and does a
particular update.

Currently I fire off my application hourly useing the built in XP Scheduler.

What I am going to do is to have my application check every minute while it is
running as I don't want to have to wait up to a hour for my particular update
to happen....

But what I am wondering about is IF I should just simply run my application
all the time in the background (there is no form needed to be visible while it
runs). Or is there a 'better' way to run my application using less resources,
etc? Is there anything special I need to do to make it a 'service'? Or what?

Any thoughts appreciated.

Regards,

Mr. B
Nov 21 '05 #1
Share this Question
Share on Google+
11 Replies


P: n/a
Yep,

Sounds like a service to me.

Oh, and make sure you use the system.timers.timer object to trigger your
logic. And if you are using vb.net to create your service, the windows
service template works just fine, but you will have to add an installer
project, and change the name of your service from service1 to
"yourservicename".

I have created many services with much success.

Best of luck,

Chris Smith
"Mr. B" <Us**@NoWhere.com> wrote in message
news:pm********************************@4ax.com...
I've an application in which I use to check out the date/time stamp of a data base... and if I find that it has been updated, my application runs and does a particular update.

Currently I fire off my application hourly useing the built in XP Scheduler.
What I am going to do is to have my application check every minute while it is running as I don't want to have to wait up to a hour for my particular update to happen....

But what I am wondering about is IF I should just simply run my application all the time in the background (there is no form needed to be visible while it runs). Or is there a 'better' way to run my application using less resources, etc? Is there anything special I need to do to make it a 'service'? Or what?
Any thoughts appreciated.

Regards,

Mr. B

Nov 21 '05 #2

P: n/a
With Deft Fingers, "Chris Smith" <us**@email.com> wrote:
Sounds like a service to me.
I have created many services with much success.
But that's it... I don't know how to make a service (let alone where to begin)
(:

I've an existing app... am I going to have to re-write it?
logic. And if you are using vb.net to create your service, the windows
service template works just fine, but you will have to add an installer


I'm using VB.net (standard) 2003... and I can't even see where I can even
start a Service app... Hmmmm....

Regards,

Mr. B
Nov 21 '05 #3

P: n/a
You can't create a service with the standard edition (AFAIK) , you will need
to u/g to professional.

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
If U Need My Email ,Ask Me

Time flies when you don't know what you're doing

"Mr. B" <Us**@NoWhere.com> wrote in message
news:65********************************@4ax.com...
With Deft Fingers, "Chris Smith" <us**@email.com> wrote:
Sounds like a service to me.
I have created many services with much success.
But that's it... I don't know how to make a service (let alone where to

begin) (:

I've an existing app... am I going to have to re-write it?
logic. And if you are using vb.net to create your service, the windows
service template works just fine, but you will have to add an installer


I'm using VB.net (standard) 2003... and I can't even see where I can even
start a Service app... Hmmmm....

Regards,

Mr. B

Nov 21 '05 #4

P: n/a
On Wed, 15 Sep 2004 03:51:06 GMT, Mr. B <Us**@NoWhere.com> wrote:

I've an application in which I use to check out the date/time stamp of a data
base... and if I find that it has been updated, my application runs and does a
particular update.

Currently I fire off my application hourly useing the built in XP Scheduler.

What I am going to do is to have my application check every minute while it is
running as I don't want to have to wait up to a hour for my particular update
to happen....

But what I am wondering about is IF I should just simply run my application
all the time in the background (there is no form needed to be visible while it
runs). Or is there a 'better' way to run my application using less resources,
etc? Is there anything special I need to do to make it a 'service'? Or what?


See if the following helps:

http://msdn.microsoft.com/library/de...l/vs0112dt.asp
http://tinyurl.com/5sjlb
Paul ~~~ pc******@ameritech.net
Microsoft MVP (Visual Basic)
Nov 21 '05 #5

P: n/a
Mr B.
As the others suggest I would create a Windows Service and use the
System.Timers.Timer.

Matthew MacDonald's book "Microsoft Visual Basic.NET Programmer's Cookbook"
has a number of topics on creating Windows Services.

I would recommend upgrading to VS.NET 2003 Professional if possible, if not
you can create a service by creating a regular Windows Application, deleting
the Form1 created. Add a new class to your project, have it inherit from
System.ServiceProcess.ServiceBase, set the project's Startup object to this
new class.

For details see:

http://msdn.microsoft.com/library/de...ClassTopic.asp

http://msdn.microsoft.com/library/de...plications.asp

http://msdn.microsoft.com/library/de...plications.asp

The last topic has a link on how to create a service without using the
designers...

Hope this helps
Jay

"Mr. B" <Us**@NoWhere.com> wrote in message
news:pm********************************@4ax.com...
I've an application in which I use to check out the date/time stamp of a
data
base... and if I find that it has been updated, my application runs and
does a
particular update.

Currently I fire off my application hourly useing the built in XP
Scheduler.

What I am going to do is to have my application check every minute while
it is
running as I don't want to have to wait up to a hour for my particular
update
to happen....

But what I am wondering about is IF I should just simply run my
application
all the time in the background (there is no form needed to be visible
while it
runs). Or is there a 'better' way to run my application using less
resources,
etc? Is there anything special I need to do to make it a 'service'? Or
what?

Any thoughts appreciated.

Regards,

Mr. B

Nov 21 '05 #6

P: n/a
This may be true in terms of project templates, but P/Invoke should
expose the Windows Services API as it always did. You basically just
need to create an executable and register it with the service manager,
which is explained (in C++) here:

http://www.gamedev.net/reference/art...rticle1899.asp

The code presented shouldn't be hard to translate to C# and P/Invoke.

The only complication I can see is that you'll probably have to write
your own message pump, old-school. This is annoying, but I don't
think it should be a deal-breaker. All the same, it's probably
cheaper and easier to simply upgrade to Professional.

Thanks,
Mike Burton
DPSI

"One Handed Man \( OHM - Terry Burns \)" <news.microsoft.com> wrote in message news:<u$**************@TK2MSFTNGP10.phx.gbl>...
You can't create a service with the standard edition (AFAIK) , you will need
to u/g to professional.

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
If U Need My Email ,Ask Me

Time flies when you don't know what you're doing

"Mr. B" <Us**@NoWhere.com> wrote in message
news:65********************************@4ax.com...
With Deft Fingers, "Chris Smith" <us**@email.com> wrote:
Sounds like a service to me.
I have created many services with much success.


But that's it... I don't know how to make a service (let alone where to

begin)
(:

I've an existing app... am I going to have to re-write it?
logic. And if you are using vb.net to create your service, the windows
service template works just fine, but you will have to add an installer


I'm using VB.net (standard) 2003... and I can't even see where I can even
start a Service app... Hmmmm....

Regards,

Mr. B

Nov 21 '05 #7

P: n/a
Acknowledged, thanks.

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
If U Need My Email ,Ask Me

Time flies when you don't know what you're doing

"Mike Burton" <li********@hotmail.com> wrote in message
news:3c**************************@posting.google.c om...
This may be true in terms of project templates, but P/Invoke should
expose the Windows Services API as it always did. You basically just
need to create an executable and register it with the service manager,
which is explained (in C++) here:

http://www.gamedev.net/reference/art...rticle1899.asp

The code presented shouldn't be hard to translate to C# and P/Invoke.

The only complication I can see is that you'll probably have to write
your own message pump, old-school. This is annoying, but I don't
think it should be a deal-breaker. All the same, it's probably
cheaper and easier to simply upgrade to Professional.

Thanks,
Mike Burton
DPSI

"One Handed Man \( OHM - Terry Burns \)" <news.microsoft.com> wrote in

message news:<u$**************@TK2MSFTNGP10.phx.gbl>...
You can't create a service with the standard edition (AFAIK) , you will need to u/g to professional.

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
If U Need My Email ,Ask Me

Time flies when you don't know what you're doing

"Mr. B" <Us**@NoWhere.com> wrote in message
news:65********************************@4ax.com...
With Deft Fingers, "Chris Smith" <us**@email.com> wrote:

>Sounds like a service to me.
>I have created many services with much success.

But that's it... I don't know how to make a service (let alone where to
begin)
(:

I've an existing app... am I going to have to re-write it?

>logic. And if you are using vb.net to create your service, the

windows >service template works just fine, but you will have to add an installer
I'm using VB.net (standard) 2003... and I can't even see where I can even start a Service app... Hmmmm....

Regards,

Mr. B

Nov 21 '05 #8

P: n/a
With Deft Fingers, "One Handed Man \( OHM - Terry Burns \)"
<news.microsoft.com> wrote:
You can't create a service with the standard edition (AFAIK) , you will need
to u/g to professional.


UgH (upgrade) (:

Pro is way too rich for my week end programming needs (I don't do this
professionally...). Oh well.. thanks!

Bruce
Nov 21 '05 #9

P: n/a
With Deft Fingers, "Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com>
wrote:
you can create a service by creating a regular Windows Application, deleting
the Form1 created. Add a new class to your project, have it inherit from
System.ServiceProcess.ServiceBase, set the project's Startup object to this


Thanks... as I don't write in a professional mode (week end programmer for
'fun')... PRO is a bit much for my needs. But I'll take a look at your
articles. Either way, it's of help. Thanks!

Bruce
Nov 21 '05 #10

P: n/a
Mike,
Why use P/Invoke?

The System.ServiceProcess.ServiceBase is part of the framework, it
encapsulates the Windows Services API and provides a Message pump for you.
Which means it is usable in the Standard edition. In fact because it is part
of the Framework you don't VS.NET at all, you can simply use notepad &
vbc.exe!

See my other post in this thread for details.

Hope this helps
Jay
"Mike Burton" <li********@hotmail.com> wrote in message
news:3c**************************@posting.google.c om...
This may be true in terms of project templates, but P/Invoke should
expose the Windows Services API as it always did. You basically just
need to create an executable and register it with the service manager,
which is explained (in C++) here:

http://www.gamedev.net/reference/art...rticle1899.asp

The code presented shouldn't be hard to translate to C# and P/Invoke.

The only complication I can see is that you'll probably have to write
your own message pump, old-school. This is annoying, but I don't
think it should be a deal-breaker. All the same, it's probably
cheaper and easier to simply upgrade to Professional.

Thanks,
Mike Burton
DPSI

"One Handed Man \( OHM - Terry Burns \)" <news.microsoft.com> wrote in
message news:<u$**************@TK2MSFTNGP10.phx.gbl>...
You can't create a service with the standard edition (AFAIK) , you will
need
to u/g to professional.

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
If U Need My Email ,Ask Me

Time flies when you don't know what you're doing

"Mr. B" <Us**@NoWhere.com> wrote in message
news:65********************************@4ax.com...
> With Deft Fingers, "Chris Smith" <us**@email.com> wrote:
>
> >Sounds like a service to me.
> >I have created many services with much success.
>
> But that's it... I don't know how to make a service (let alone where to

begin)
> (:
>
> I've an existing app... am I going to have to re-write it?
>
> >logic. And if you are using vb.net to create your service, the windows
> >service template works just fine, but you will have to add an
> >installer
>
> I'm using VB.net (standard) 2003... and I can't even see where I can
> even
> start a Service app... Hmmmm....
>
> Regards,
>
> Mr. B

Nov 21 '05 #11

P: n/a
Something else I learnt today,

thanks Jay

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
If U Need My Email ,Ask Me

Time flies when you don't know what you're doing

"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Mike,
Why use P/Invoke?

The System.ServiceProcess.ServiceBase is part of the framework, it
encapsulates the Windows Services API and provides a Message pump for you.
Which means it is usable in the Standard edition. In fact because it is part of the Framework you don't VS.NET at all, you can simply use notepad &
vbc.exe!

See my other post in this thread for details.

Hope this helps
Jay
"Mike Burton" <li********@hotmail.com> wrote in message
news:3c**************************@posting.google.c om...
This may be true in terms of project templates, but P/Invoke should
expose the Windows Services API as it always did. You basically just
need to create an executable and register it with the service manager,
which is explained (in C++) here:

http://www.gamedev.net/reference/art...rticle1899.asp

The code presented shouldn't be hard to translate to C# and P/Invoke.

The only complication I can see is that you'll probably have to write
your own message pump, old-school. This is annoying, but I don't
think it should be a deal-breaker. All the same, it's probably
cheaper and easier to simply upgrade to Professional.

Thanks,
Mike Burton
DPSI

"One Handed Man \( OHM - Terry Burns \)" <news.microsoft.com> wrote in
message news:<u$**************@TK2MSFTNGP10.phx.gbl>...
You can't create a service with the standard edition (AFAIK) , you will
need
to u/g to professional.

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
If U Need My Email ,Ask Me

Time flies when you don't know what you're doing

"Mr. B" <Us**@NoWhere.com> wrote in message
news:65********************************@4ax.com...
> With Deft Fingers, "Chris Smith" <us**@email.com> wrote:
>
> >Sounds like a service to me.
> >I have created many services with much success.
>
> But that's it... I don't know how to make a service (let alone where to begin)
> (:
>
> I've an existing app... am I going to have to re-write it?
>
> >logic. And if you are using vb.net to create your service, the windows > >service template works just fine, but you will have to add an
> >installer
>
> I'm using VB.net (standard) 2003... and I can't even see where I can
> even
> start a Service app... Hmmmm....
>
> Regards,
>
> Mr. B


Nov 21 '05 #12

This discussion thread is closed

Replies have been disabled for this discussion.