Re: How to specify current logged in user for File Open dialog?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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.

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
Joseph M. Newcomer [MVP]
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
.



Relevant Pages

  • Re: How to specify current logged in user for File Open dialog?
    ... error message is correct. ... should not be interacting with the user, especially with a file open dialog. ... interface with some service gingerbread and pretend it is a service. ... When I need a GUI interface to a service, ...
    (microsoft.public.vc.mfc)
  • Re: Great SWT Program
    ... not sure what the user interface of 2057 will be like, ... simplifying the mechanics of interaction so that the mechanics would ... and decomposing monoliths into interacting ...
    (comp.lang.java.programmer)
  • Re: Fortran77 & GUI
    ... But, assuming the user makes a mistake in the input file, ... he has to run the code first, check the error message that pops up on ... very familiar with developing similar codes. ... parameters are interacting (say, for large enough codes which address ...
    (comp.lang.fortran)
  • Re: MSN Messenger and MCEXP
    ... If you think about it, however, this would be a major change to the way most ... are used to interacting with MCE. ... If we move to portable TabletPCs as the control interface, ... connection interface to MCE will have to change to support it easily. ...
    (microsoft.public.windows.mediacenter)
  • Re: Deferencing void pointer
    ... falls outside the C++ "official interface" for interacting with C. ...
    (comp.lang.c)