How to start the exe server in hide mode or another desktop?
-
If a component was implemented in a exe server, the owner of the exe process would be created when a client use ::CoCreateInstance to retrieve such a interface. I want to run the server in a hide mode, i use ShellExecute with SW_HIDE flag to start the exe server, but the exe still runs as normal. So, i want to create another new desktop and create the target process on that desktop, but the problem is, the ::CoCreateInstance would fail. The steps look like following:
HDESK hDesk = ...//Create a new desktop
if(hDesk){
SetThreadDesktop(hDesk);//associated current thread to that desktop
...//Create target process on that desktop
hr = ::CoCreateInstance(...);//create interface
//here, the return hr always be 0x80080005(Server execution failed)
}If so, how should i fix such problem?
-
If a component was implemented in a exe server, the owner of the exe process would be created when a client use ::CoCreateInstance to retrieve such a interface. I want to run the server in a hide mode, i use ShellExecute with SW_HIDE flag to start the exe server, but the exe still runs as normal. So, i want to create another new desktop and create the target process on that desktop, but the problem is, the ::CoCreateInstance would fail. The steps look like following:
HDESK hDesk = ...//Create a new desktop
if(hDesk){
SetThreadDesktop(hDesk);//associated current thread to that desktop
...//Create target process on that desktop
hr = ::CoCreateInstance(...);//create interface
//here, the return hr always be 0x80080005(Server execution failed)
}If so, how should i fix such problem?
You could try
CreateProcess
with thewShowWindow
member of theSTARTUPINFO
structure set toSW_HIDE
. Also remember to set theSTARTF_USESHOWWINDOW
flag in thedwFlags
member.«_Superman_» I love work. It gives me something to do between weekends.
Microsoft MVP (Visual C++) -
You could try
CreateProcess
with thewShowWindow
member of theSTARTUPINFO
structure set toSW_HIDE
. Also remember to set theSTARTF_USESHOWWINDOW
flag in thedwFlags
member.«_Superman_» I love work. It gives me something to do between weekends.
Microsoft MVP (Visual C++)