Okay, it's time to return back to your original design. You say you run the program from your service. Windows Vista/7 service runs in a separate non-interactive session, so any process the service launches remains running in the session, which means no interaction with desktop. Unless you make it run interactive intentionally, which I guess you did not.
What is the OS version you do that run in?
If the OS is XP, do you instruct your service run interactive? If you do, remove the interactive flag.
I wonder if the OP actually has a real service application or is running a pseudo service (like a console application)?
@OP, can you answer if you have created a Windows service application, and if you have are you running it under the System account or under a user account?
Btw, I ask because if you are using a real Windows Service application running under a Service account and it launches a Windows app, you will not see that app run in the logged on user's desktop regardless of whether you have set the app to be shown or not in the CreateProcess call.
Btw, I ask because if you are using a real Windows Service application running under a Service account and it launches a Windows app, you will not see that app run in the logged on user's desktop regardless of whether you have set the app to be shown or not in the CreateProcess call.
Not exactly. I provided sample in the post where service is able to run app in the interactive user session. This is what generally I meant by saying "make it run interactive intentionally."
Not exactly. I provided sample in the post where service is able to run app in the interactive user session. This is what generally I meant by saying "make it run interactive intentionally."
I'm aware of running a service interactively. Since that isn't a best practice and only works for the first logged on user, I'm kind of ignoring that special case.
The bottom line is to use the Windows features as intended rather than doing some hack to get things to work (because as we all know, what works as a hack now, may not work in the next release of Windows).
That being said, I don't mean to imply that you are suggesting any sort of hack.
There's definitely some misunderstanding there. I told about running interactive process from non-interactive service. And I nevere recommended running services interacting with desktop directly in the same session & window station. I hoped for all the years we're on CG you know me better.
There's definitely some misunderstanding there. I told about running interactive process from non-interactive service. And I nevere recommended running services interacting with desktop directly in the same session & window station. I hoped for all the years we're on CG you know me better.
I didn't mean to imply that you had, athough I must admit that my wording wasn't too clear.
If you really want to be helped, you should read and answer all the questions you've been asked in this thread, and be be more verbose in your explanations.
Originally Posted by kw1991
i tried setting the service to interact with the desktop but that doesn't work either
As far as I remember, you complained about program window showing in interactive desktop. So your try made no sense, as what you need is exactly opposite.
ok what questions still need answering? i am using Windows 7, i created a windows service application using c++ visual studio and it uses the local service account
Then your problem is the program that you launch from your service. And I really doubt you'd be able to play the hook game in this case.
See the sample I attach here. Make it, do setup and try test run. The teast.exe process must be present in the list, and its session must be 0 (non-interactive service session).
Then change the service source code to launch you program and see if it starts in session 0. Please remember, we're talking about Windows 7. When you get what you want in Win7, we can start curing your problem in XP.
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.