473,387 Members | 1,534 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Writing a service and GUI

I would like to write a service that handles certain tasks fro a third
party back end. There is an API for the back end that I can use to
accomplish this, but there are certain calls I have to make to the API
that put up a UI. There is no way to aviod the UI, but if write the
service will it crash when the API trys to put up a UI? I'd really like
to know this before I go ahead and put all the effort into writing the
service. Any help would be greatly appreciated. Thnx.

May 22 '06 #1
8 1721
songstre,
If you set up your Service to allow interaction with the desktop, it can put
up a GUI, but this is generally inadavisable since a service starts running
before there is anyone actually logged into the machine. If it attempts to
put up its GUI and nobody has logged, on, you have big problems.

Maybe you should look into factoring out the gui portion as a separate
application or even a web application that can communicate with the service
via TCP sockets, Remoting, or even named pipes.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"songstre" wrote:
I would like to write a service that handles certain tasks fro a third
party back end. There is an API for the back end that I can use to
accomplish this, but there are certain calls I have to make to the API
that put up a UI. There is no way to aviod the UI, but if write the
service will it crash when the API trys to put up a UI? I'd really like
to know this before I go ahead and put all the effort into writing the
service. Any help would be greatly appreciated. Thnx.

May 22 '06 #2
<<factoring out the gui portion >>
Yes, I'd like to. But it's the dll of the API that's popping it up and
I have no control over that. But the method call that pops it up
(Search) is the only method that provides me the functionality I need.
Eventually I will write my own product for this (image storage and
retireval), but uuntil then, I needed to know if this dll showing a GUI
is going to make my service crash or not.

May 22 '06 #3
songstre wrote:
<<factoring out the gui portion >>
Yes, I'd like to. But it's the dll of the API that's popping it up and
I have no control over that. But the method call that pops it up
(Search) is the only method that provides me the functionality I need.
Eventually I will write my own product for this (image storage and
retireval), but uuntil then, I needed to know if this dll showing a GUI
is going to make my service crash or not.

I dont think it would make it crash.
It would just hang(wait) until the gui disappears presuming it is single
threaded.
You might need to spawn another thread maybe, to find and kill the gui
when it appears.
Not clean or guaranteed to work :)

JB
May 22 '06 #4

"John B" <jb******@yahoo.com> wrote in message
news:44**********@news.iprimus.com.au...
| songstre wrote:
| > <<factoring out the gui portion >>
| > Yes, I'd like to. But it's the dll of the API that's popping it up and
| > I have no control over that. But the method call that pops it up
| > (Search) is the only method that provides me the functionality I need.
| > Eventually I will write my own product for this (image storage and
| > retireval), but uuntil then, I needed to know if this dll showing a GUI
| > is going to make my service crash or not.
| >
| I dont think it would make it crash.
| It would just hang(wait) until the gui disappears presuming it is single
| threaded.
| You might need to spawn another thread maybe, to find and kill the gui
| when it appears.
| Not clean or guaranteed to work :)
|
| JB

And how would you know it appears when there is no active desktop? Realy
this is something you should never do, the popups will or block the
application or they will simply add up dending whether they are modal or
non-modal dialogs. Each dialog will consume valuable GDI and user space (non
pooled memory), until the moment no space is left and the system halts.

Willy.
May 23 '06 #5

"songstre" <so******@gmail.com> wrote in message
news:11**********************@j55g2000cwa.googlegr oups.com...
| <<factoring out the gui portion >>
| Yes, I'd like to. But it's the dll of the API that's popping it up and
| I have no control over that. But the method call that pops it up
| (Search) is the only method that provides me the functionality I need.
| Eventually I will write my own product for this (image storage and
| retireval), but uuntil then, I needed to know if this dll showing a GUI
| is going to make my service crash or not.
|

No one can answer this question, the library was never meant to be used from
a service, so it's not tested in such an application. If you need to know,
you will have to test it yourself, all we can say is that it's a bad idea to
use it in production, not only because of possible UI issues, there are also
other thing's to keep in mind, a Windows service is sandboxed in a separate
security context, you can't access the interactive users profile nor it's
environment, who guarantees the library doesn't need this?

Willy.
May 23 '06 #6
All great points. Thanks everyone. I know that there is a component
that was written by a co-worker that uses the library. It is run as a
Scheduled Task rather than a service and has been working, for the most
part. Any comments on this? The GUI that pops up when the search is
executed is informational and goes away automatically.

May 23 '06 #7
I've been in this situation as well. There's not much you can do about
it. Try to get the vendor to change the library.

Brian

songstre wrote:
I would like to write a service that handles certain tasks fro a third
party back end. There is an API for the back end that I can use to
accomplish this, but there are certain calls I have to make to the API
that put up a UI. There is no way to aviod the UI, but if write the
service will it crash when the API trys to put up a UI? I'd really like
to know this before I go ahead and put all the effort into writing the
service. Any help would be greatly appreciated. Thnx.


May 23 '06 #8
Willy Denoyette [MVP] wrote:
"John B" <jb******@yahoo.com> wrote in message
news:44**********@news.iprimus.com.au...
| songstre wrote:
| > <<factoring out the gui portion >>
| > Yes, I'd like to. But it's the dll of the API that's popping it up and
| > I have no control over that. But the method call that pops it up
| > (Search) is the only method that provides me the functionality I need.
| > Eventually I will write my own product for this (image storage and
| > retireval), but uuntil then, I needed to know if this dll showing a GUI
| > is going to make my service crash or not.
| >
| I dont think it would make it crash.
| It would just hang(wait) until the gui disappears presuming it is single
| threaded.
| You might need to spawn another thread maybe, to find and kill the gui
| when it appears.
| Not clean or guaranteed to work :)
|
| JB

And how would you know it appears when there is no active desktop? Realy
this is something you should never do, the popups will or block the
application or they will simply add up dending whether they are modal or
non-modal dialogs. Each dialog will consume valuable GDI and user space (non
pooled memory), until the moment no space is left and the system halts.

Willy.

You are of course correct :)
That is why I appended the | Not clean or guaranteed to work :)

line at the end.

WRT the active desktop(or lack thereof), I havent tried this but if I
was running a thread spawned from the service thread then I would
presume (maybe incorrectly) that I could get access to these popups when
they appeared.

As I said, not pretty but it would be _a solution_ to the problem if it
worked as I anticipated.

JB
May 24 '06 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Glenn Venzke | last post by:
I'd like to write a windows service. Unfortunately, my company would only spring for the standard edition of VB.NET which doesn't support the creation of windows services. Is it possible to write one...
3
by: Chris Dunaway | last post by:
I am writing a Windows Service that reads and processes files on a set schedule. I want to create a second app that can monitor the Windows service. The Windows service will write trace messages...
0
by: =?ISO-8859-1?Q?Mickel_Gr=F6nroos?= | last post by:
Hi fellow pythoneers, I'm thinking about writing a simple web service for use in the "Research Task Pane" in Microsoft Office. There is a lot of C# and VB code samples out there and tutorials on...
5
by: gnanapoongothai | last post by:
hi, i am doing socket programming , and once socket is connected getting data from client and wrting into the file. the file is created but nothing is in it? whats up ? code: WORD...
0
by: Sid Price | last post by:
I am writing a service using VB.NET 2005 and having some trouble getting started. I sued the wizard to create the service and I have added some code to the "OnStart" method. Using the technique...
2
by: Solomon_Man | last post by:
All, I have a Windows Service application that has database connectivity and needs the capability to let a user know that there has been a db failure. What is the proper way to notify a user that...
2
by: cj | last post by:
<System.Web.Services.WebService(Name:="CJ's Service", Description:="Testing 123", Namespace:="http://myco.com/cj/one")_...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.