Issue with ShellExecute on Windows 7 in windows service application
-
Hi, I have created the windows service which does the ShellExecute command on noteapad.exe. When service is installed the notepad.exe is executed and only seen in task manager. The Notepad.exe window is not visible. Could anyone let me know what may be the issue with this, I have tried this on Windows XP where it works fine. Following is the code for SheelExecute
::ShellExecute(NULL,
NULL,
_T("notepad.exe"),
_T("C:\\Users\\testuser\\Desktop\\review_comments.txt"),
_T("C:\\Windows\\System32"),
SW_SHOWMAXIMIZED);Thanks in advance "A winner is not one who never fails...but the one who never quits"
-
Hi, I have created the windows service which does the ShellExecute command on noteapad.exe. When service is installed the notepad.exe is executed and only seen in task manager. The Notepad.exe window is not visible. Could anyone let me know what may be the issue with this, I have tried this on Windows XP where it works fine. Following is the code for SheelExecute
::ShellExecute(NULL,
NULL,
_T("notepad.exe"),
_T("C:\\Users\\testuser\\Desktop\\review_comments.txt"),
_T("C:\\Windows\\System32"),
SW_SHOWMAXIMIZED);Thanks in advance "A winner is not one who never fails...but the one who never quits"
From Vista onwards, services are isolated in session 0 and cannot show any UI. You will need to use
CreateProcessAsUser
/CreateProcessWithLogonW
/CreateProcessWithTokenW
APIs to initiate UI application from services.«_Superman_» _I love work. It gives me something to do between weekends.