469,582 Members | 2,316 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,582 developers. It's quick & easy.

Any good links on how to thing when designing windows services

Jippie, got my first c# service working with XP/W2003srv (love
google), but got an hunch that vista will not support services that
uses GUI (can interact with desktop... checkbox in services gone?),

yepp (solution) can have 2 programs - one service and one normal GUI,
just wondering if anything else changes in the near future? sort of a
sneak peak into what trouble im haeding in to... gotta convert some
vb6 code soon that is like that will likely to be c# or vb.net for the
converted app... nice if I did it right the first time (for the first
time ;) )

we are not running vista, not eaven in the test env. we are sort of
staying of the (b)leeading edge, always wait until SP2 before u
upgrade to a new MS OS looks like a good ia, so far anyway.

just wanna tap in to the thinktank ;)

Well, got rid of the last 2 OS/2 machines a year ago so im moving in
the right direction (?), but on the other hand didnt have any worries
about antivirus upgrades for those babys thease last years...

English isnt my strong side, hope you can get heads or tails of what
I'm after...

//CY
Dec 4 '07 #1
2 1149
having a service that interacts with the desktop is generally a very bad idea
anyway. The whole concept of a windows service is that it start with the OS -
before any real user has logged on. So if your service wants to do UI but
there is no desktop, what do you think will happen?

--Peter
"Inside every large program, there is a small program trying to get out."
http://www.eggheadcafe.com
http://petesbloggerama.blogspot.com
http://www.blogmetafinder.com

"ch*******@gmail.com" wrote:
Jippie, got my first c# service working with XP/W2003srv (love
google), but got an hunch that vista will not support services that
uses GUI (can interact with desktop... checkbox in services gone?),

yepp (solution) can have 2 programs - one service and one normal GUI,
just wondering if anything else changes in the near future? sort of a
sneak peak into what trouble im haeding in to... gotta convert some
vb6 code soon that is like that will likely to be c# or vb.net for the
converted app... nice if I did it right the first time (for the first
time ;) )

we are not running vista, not eaven in the test env. we are sort of
staying of the (b)leeading edge, always wait until SP2 before u
upgrade to a new MS OS looks like a good iéa, so far anyway.

just wanna tap in to the thinktank ;)

Well, got rid of the last 2 OS/2 machines a year ago so im moving in
the right direction (?), but on the other hand didnt have any worries
about antivirus upgrades for those babys thease last years...

English isn´t my strong side, hope you can get heads or tails of what
I'm after...

//CY
Dec 4 '07 #2
On 4 Dec, 22:32, Peter Bromberg [C# MVP]
<pbromb...@yahoo.NoSpamMaam.comwrote:
having a service that interacts with the desktop is generally a very bad idea
anyway. The whole concept of a windows service is that it start with the OS -
before any real user has logged on. So if your service wants to do UI but
there is no desktop, what do you think will happen?

--Peter
"Inside every large program, there is a small program trying to get out."http://www.eggheadcafe.comhttp://petesbloggerama.blogspot.comhttp://www.blogmetafinder.com
Shure, on my openVMS all logging goes to textfiles but this was a
"normal" VB6 program from the start that I made to a service to get
rid of the fact that I had to be logged in.

Well, it (UI) works in my VB6 service (when i found ntsvc.ocx or
whatever it was called some years ago), UI just showing what happens
(have to check box "can interact with desktop")- connect DB, read
file, update DB and so on, and more important what not when an error
occures, but (obviusly) only when support personel loggs in (no
special handling in code for that).

and yes i write log files with the same info, it makes life easyer if
the server stops for any reason to rule out my program, but that hasnt
happend /yet/ - havent used eventlogger in my VB6 service, in the C#
service I write to the eventlogg instead - no (G)UI there.

Looking for guidelines about programming services (ready/prepared for
the future development of windows), yes my app is threaded, no
racecondition what I can see, should be threadsafe *but* can one ever
be safe from bugs, dont think so....

had a worry about not using thread.sleep(5) in my while(true) loop, it
gets a bit slower but the service shoul never be able to drain all cpu
from the server, connecting to a RFID reader and that *should* take
250-700ms depending on read method, but if it goes wrong then I do
error logging and sleep 5 sek, the 5 ms delay is for an event where I
dont see that it goes wrong and it dosnt take 250-700ms, then the
program would be like (worst case)

no real code, just how the program could behave

while(true) // should never stop reading
{
if (false) // an error occured that I didnt expect, the false is the
return value from the reading of RFID, someone stole its static IP
address for ex.
{
}
}

so I put in a sleep in the main while loop just to be safe..

//CY
Dec 5 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

24 posts views Thread by matty | last post: by
33 posts views Thread by Jerry Boone | last post: by
63 posts views Thread by John Salerno | last post: by
2 posts views Thread by sck10 | last post: by
reply views Thread by humbleaptience | last post: by
reply views Thread by suresh191 | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.