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