darrgyas
asked on
show process window
Hi all,
I have written a service that starts a process:
STARTUPINFO si;
PROCESS_INFORMATION pi;
memset(&pi, 0, sizeof(pi));
memset(&si, 0, sizeof(si));
si.cb = sizeof(si);
si.dwFlags = STARTF_USESHOWWINDOW;
si.wShowWindow = SW_NORMAL | SW_SHOW;
CreateProcess(<ExeName>, NULL, NULL, NULL, FALSE,
CREATE_DEFAULT_ERROR_MODE, NULL,<WorkingFolder>, &si, &pi))
This works, but the window for <ExeName> is not shown (it's a console application)
How do I create that process so that console window will always be shown?
Thank you.
I have written a service that starts a process:
STARTUPINFO si;
PROCESS_INFORMATION pi;
memset(&pi, 0, sizeof(pi));
memset(&si, 0, sizeof(si));
si.cb = sizeof(si);
si.dwFlags = STARTF_USESHOWWINDOW;
si.wShowWindow = SW_NORMAL | SW_SHOW;
CreateProcess(<ExeName>, NULL, NULL, NULL, FALSE,
CREATE_DEFAULT_ERROR_MODE,
This works, but the window for <ExeName> is not shown (it's a console application)
How do I create that process so that console window will always be shown?
Thank you.
ASKER
If I start some dialog-based applicationfrom the service, like notepad - it is visible.
Also, if checking "allow this service to interact..." in the services applet does not do anything, will doing it programmatically work?
Also, if checking "allow this service to interact..." in the services applet does not do anything, will doing it programmatically work?
What Windows version are you on?
ASKER
server 2003
ASKER
I tried CREATE_NEW_CONSOLE - no effect
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
That works, thank you.
The points well deserved, but just to push my luck is it possible to show console for the service itself?
The points well deserved, but just to push my luck is it possible to show console for the service itself?
I am afraid that this would require opening the window station, adjusting the privileges etc. - IOW a lot of effort. I'd rather recommend to use an application that is launech in the user's context and with which you communicate with some IPC means if you need to display any status updates or something similar.
ASKER
Thank you, I appreciate it.
>>[...]
>>This works, but the window for <ExeName> is not shown (it's a console
>>application)
The reason for this is that services run on their own desktop, which is invisible to the logged on user. If you want the window to be visible, you need to either set your service to interact with the user's desktop using 'SERVICE_INTERACTIVE_PROCE
In a nutshell: This is helluva a task if you do not want to risk a security breach and use deprecated methods like SERVICE_INTERACTIVE_PROCES