allow service to interact with desktop - vista and managed code

A

almir

Hi,



under Vista it is not possible to interact with users-desktop msdn
suggests using CreateProcessAsUser and I found a partial
implementation of this method in managed code here
http://odetocode.com/Blogs/scott/archive/2004/10/28/602.aspx however
i do not know how to obtain token of a user which is currently loged
in which means that I have a problem in this line
IntPtr hToken = WindowsIdentity.GetCurrent().Token; //here i get a
service token and I need user token so that i can start application in
its context, what is the right way to do it ?


do you know any other implementation which enables me to start
application so that it is visible by user?

thanks
almir
 
M

Michael Nemtsev [MVP]

Hello almir,

Why do u need to allow service interact with desktop?
And what does "application so that it is visible by user" mean?

As I understand u need to provide the general service without UI, but use
any IPC (interprocess communication) to talk to you separate UI application

---
WBR,
Michael Nemtsev [.NET/C# MVP] :: blog: http://spaces.live.com/laflour

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo


a> Hi,
a>
a> under Vista it is not possible to interact with users-desktop msdn
a> suggests using CreateProcessAsUser and I found a partial
a> implementation of this method in managed code here
a> http://odetocode.com/Blogs/scott/archive/2004/10/28/602.aspx however
a> i do not know how to obtain token of a user which is currently loged
a> in which means that I have a problem in this line
a> IntPtr hToken = WindowsIdentity.GetCurrent().Token; //here i get a
a> service token and I need user token so that i can start application
a> in
a> its context, what is the right way to do it ?
a> do you know any other implementation which enables me to start
a> application so that it is visible by user?
a>
a> thanks
a> almir
 
A

almir

yes,
the problem is however starting application in user context, so that
he can see it
 
M

Mezga Geza

This method works also in Vista:
http://it.expertmonster.com/question/Allow-service-to-interact-with-desktop-112.html
Hi,



under Vista it is not possible to interact with users-desktop msdn
suggests using CreateProcessAsUser and I found a partial
implementation of this method in managed code here
http://odetocode.com/Blogs/scott/archive/2004/10/28/602.aspx however
i do not know how to obtain token of a user which is currently loged
in which means that I have a problem in this line
IntPtr hToken = WindowsIdentity.GetCurrent().Token; //here i get a
service token and I need user token so that i can start application in
its context, what is the right way to do it ?


do you know any other implementation which enables me to start
application so that it is visible by user?

thanks
almir
On Tuesday, December 04, 2007 2:11 AM Michael Nemtsev [MVP] wrote:
Hello almir,

Why do u need to allow service interact with desktop?
And what does "application so that it is visible by user" mean?

As I understand u need to provide the general service without UI, but use
any IPC (interprocess communication) to talk to you separate UI application

---
WBR,
Michael Nemtsev [.NET/C# MVP] :: blog: http://spaces.live.com/laflour

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo


a> Hi,
a>
a> under Vista it is not possible to interact with users-desktop msdn
a> suggests using CreateProcessAsUser and I found a partial
a> implementation of this method in managed code here
a> http://odetocode.com/Blogs/scott/archive/2004/10/28/602.aspx however
a> i do not know how to obtain token of a user which is currently loged
a> in which means that I have a problem in this line
a> IntPtr hToken = WindowsIdentity.GetCurrent().Token; //here i get a
a> service token and I need user token so that i can start application
a> in
a> its context, what is the right way to do it ?
a> do you know any other implementation which enables me to start
a> application so that it is visible by user?
a>
a> thanks
a> almir
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top