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. Windows Development
  4. Can I use Windows?

Can I use Windows?

Scheduled Pinned Locked Moved Windows Development
question
4 Posts 4 Posters 34 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.
  • Richard Andrew x64R Offline
    Richard Andrew x64R Offline
    Richard Andrew x64
    wrote on last edited by
    #1

    I know that services are not allowed to interact with any of the desktops. I take this to mean that a service cannot create and/or display windows on any desktop. But can the service interact with windows that are already on any of the desktops? If not send messages, then can a service use Win32 functions to learn information about the existing windows, like their caption text?

    The difficult we do right away... ...the impossible takes slightly longer.

    J R D 3 Replies Last reply
    0
    • Richard Andrew x64R Richard Andrew x64

      I know that services are not allowed to interact with any of the desktops. I take this to mean that a service cannot create and/or display windows on any desktop. But can the service interact with windows that are already on any of the desktops? If not send messages, then can a service use Win32 functions to learn information about the existing windows, like their caption text?

      The difficult we do right away... ...the impossible takes slightly longer.

      J Offline
      J Offline
      jschell
      wrote on last edited by
      #2

      Richard Andrew x64 wrote:

      I know that services are not allowed to interact with any of the desktops.

      I open the Services applet. Pick any service at random. Right click. Properties Select Tab that says "Log On" There is a check box under "Local System account" that says "Allow service to interact with desktop"

      Richard Andrew x64 wrote:

      I take this to mean that a service cannot create and/or display windows on any desktop.

      Is "Greenshot" not a windows service? Maybe just a task applet. Certainly you could create an task applet as he UI then the service could talk to and use that. Like SQL Server, Oracle, Docker, etc. But even so I suspect that a service can create windows. Just not an easy task. Following google suggests that

      windows create UI from windows service

      Richard Andrew x64 wrote:

      If not send messages, then can a service use Win32 functions to learn information about the existing windows, like their caption text?

      Probably but first you must get the window itself. Following seems to suggest how to list windows. https://stackoverflow.com/questions/42589496/getting-a-list-of-all-open-windows-in-c-and-storing-them[^] No doubt all of the above is impacted by permissions.

      1 Reply Last reply
      0
      • Richard Andrew x64R Richard Andrew x64

        I know that services are not allowed to interact with any of the desktops. I take this to mean that a service cannot create and/or display windows on any desktop. But can the service interact with windows that are already on any of the desktops? If not send messages, then can a service use Win32 functions to learn information about the existing windows, like their caption text?

        The difficult we do right away... ...the impossible takes slightly longer.

        R Offline
        R Offline
        RedDk
        wrote on last edited by
        #3

        Lemme wade in here: Simple Windows Service in C++[^] From the word "Service", used in the title of the article, I would surmise that there's at least a 30% chance of it being used in reference to the MS "Windows" shingle. Peering at the code I see nothing but orders for mother to stay up there until I get back.

        1 Reply Last reply
        0
        • Richard Andrew x64R Richard Andrew x64

          I know that services are not allowed to interact with any of the desktops. I take this to mean that a service cannot create and/or display windows on any desktop. But can the service interact with windows that are already on any of the desktops? If not send messages, then can a service use Win32 functions to learn information about the existing windows, like their caption text?

          The difficult we do right away... ...the impossible takes slightly longer.

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #4

          Typically, in today's "security" world, you wouldn't try to interact with the desktop from a service. Normally, you write two apps. The first is your Windows service app that does whatever work you need, and the second is a normal UI app that talks to the service over a named pipe or other IPC channel as your requirements dictate.

          Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles. Dave Kreskowiak

          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