Re: How to specify current logged in user for File Open dialog?
- From: Joseph M. Newcomer <newcomer@xxxxxxxxxxxx>
- Date: Thu, 27 Sep 2007 12:45:57 -0400
First, you should not be putting dialogs in services. This has a number of problems, not
the least of which is massive security issues.
Since LocalService is not really an "account" and has no user associated with it, the
error message is correct.
The problem is that you have thought of a service as being an interactive user program,
and this is a fundamental design error. A service is a service. Ideally, a service
should not be interacting with the user, especially with a file open dialog. You really
need to rethink what you are doing.
This is a common mistake, by the way, thinking that you can wrap a program with a GUI
interface with some service gingerbread and pretend it is a service. The presence of a
utility that makes this easy is seductive, but I consider the whole issue of user
interfaces on services to be a mistake. When I need a GUI interface to a service, I write
a program whose job it is to interact with the service, and it usually does this via a
named pipe. The service has no interaction capability directly.
joe
On Thu, 27 Sep 2007 01:28:16 -0700, Martin <martin-g@xxxxxxx> wrote:
Hi.Joseph M. Newcomer [MVP]
I have a dialog application, which is being launched in the context of
"LOCAL SERVICE" user. There is a 'Browse' on it, which opens standard
File Open dialog, and when the user selects 'Desktop', it gets an
error message:
"C:\Documents and Settings\LocalService\Desktop refers to a location
that is unavailable....."
I can't change the user context of the application, it really needs
privileges of "LOCAL SERVICE". How can I specify current logged in
user for Open File dialog, is it possible?
Thanks,
Martin
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
.
- Follow-Ups:
- References:
- Prev by Date: Re: A question about Console window(display or not display)
- Next by Date: Re: starting point
- Previous by thread: Re: How to specify current logged in user for File Open dialog?
- Next by thread: Re: How to specify current logged in user for File Open dialog?
- Index(es):
Relevant Pages
|