tags:

views:

90

answers:

1

Hi, I want to build similar experience as google desktop search is giving while opening the file. Suppose the user is searching for a particular file and he clicks on it in the browser, google desktop is opening it in foreground, i tried to do this in my app but it some times opens in background.

I used ShellExecuteEx and then AllowSetForegroundWindow using the process handle returned. I know there are situations where processhandle will return NULL, but in my case even if I got valid process handle, AllowSetForegroundWindow returned with Access Denied error.

I think here the issue is my application is running as a service and the foreground application is the browser.

Can anyone help me here? i want to give the same experience as google desktop while clicking the file.

Thanks in advance.

A: 

Please use CreateProcessAsUser and pass explorer.exe user token. Thanks.

Yigang Wu
And if explorer is not running?
Anders