Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. ATL / WTL / STL
  4. How to start the exe server in hide mode or another desktop?

How to start the exe server in hide mode or another desktop?

Scheduled Pinned Locked Moved ATL / WTL / STL
helpsysadmintutorialquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kcynic
    wrote on last edited by
    #1

    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?

    _ 1 Reply Last reply
    0
    • K kcynic

      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?

      _ Offline
      _ Offline
      _Superman_
      wrote on last edited by
      #2

      You could try CreateProcess with the wShowWindow member of the STARTUPINFO structure set to SW_HIDE. Also remember to set the STARTF_USESHOWWINDOW flag in the dwFlags member.

      «_Superman_» I love work. It gives me something to do between weekends.
      Microsoft MVP (Visual C++)

      K 1 Reply Last reply
      0
      • _ _Superman_

        You could try CreateProcess with the wShowWindow member of the STARTUPINFO structure set to SW_HIDE. Also remember to set the STARTF_USESHOWWINDOW flag in the dwFlags member.

        «_Superman_» I love work. It gives me something to do between weekends.
        Microsoft MVP (Visual C++)

        K Offline
        K Offline
        kcynic
        wrote on last edited by
        #3

        oh, i forgot to say, this method still can't start the exe server in background

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups