Answered by:
why windows service can not interact with UI

Question
-
tell me what is the problem for which we can not show message box from win service?Saturday, October 22, 2016 7:15 PM
Answers
-
>>tell me what is the problem for which we can not show message box from win service?
The service process is not running inside a GUI which means that the MessageBox or any other window won't launch inside of any interactively logged in user's window.It doesn't make much sense to display a GUI from a Windows service. A GUI application is supposed to be run from a logged in user's desktop and there is no such desktop for the running service.
Hope that helps.
Please remember to close your threads by marking helpful posts as answer and then start a new thread if you have a new question. Please don't ask several questions in the same thread.
- Proposed as answer by Wendy ZangMicrosoft contingent staff Monday, October 24, 2016 6:33 AM
- Marked as answer by Sudip_inn Monday, October 24, 2016 3:03 PM
Sunday, October 23, 2016 4:43 PM
All replies
-
Cause it would raise server security issues.
When you need interaction, then write a second program, which runs normally under the current user account and IPC with your service (named pipes for example).
Why do you want to interact with the desktop?
Sunday, October 23, 2016 10:48 AM -
It's a console like application with a purpose of running unattended without any user interaction.
https://msdn.microsoft.com/en-us/library/windows/desktop/ms683502(v=vs.85).aspx
Sunday, October 23, 2016 11:48 AM -
can u give me any article link which guide me step by step to design win service and GUI apps which interact between each other by IPC. thanksSunday, October 23, 2016 4:41 PM
-
>>tell me what is the problem for which we can not show message box from win service?
The service process is not running inside a GUI which means that the MessageBox or any other window won't launch inside of any interactively logged in user's window.It doesn't make much sense to display a GUI from a Windows service. A GUI application is supposed to be run from a logged in user's desktop and there is no such desktop for the running service.
Hope that helps.
Please remember to close your threads by marking helpful posts as answer and then start a new thread if you have a new question. Please don't ask several questions in the same thread.
- Proposed as answer by Wendy ZangMicrosoft contingent staff Monday, October 24, 2016 6:33 AM
- Marked as answer by Sudip_inn Monday, October 24, 2016 3:03 PM
Sunday, October 23, 2016 4:43 PM -
https://code.msdn.microsoft.com/windowsapps/CSCreateProcessAsUserFromSe-b682134e
I have never used it try it and see what happens.
- Proposed as answer by Wendy ZangMicrosoft contingent staff Monday, October 24, 2016 6:33 AM
Sunday, October 23, 2016 4:48 PM