Windows API ::FindWindow function fails when called from Service application. GetLastError() also returns 0 (success?). Is this some privilege\access right problem? Do you think it's design problem and I should use another IPC method?
leppie's right, Windows services are usually denied in interaction with desktop. You can bypass that in XP and earlier versions but won't be able to do in Vista and above. You'd better delegate desktop and user interactions to a GUI application. See this document for details.
Services run in Session 0. On XP and earlier, the first user to log in also runs in Session 0, and subsequent users run in Sessions 1 and higher. If the service is set to "Interact with the Desktop", then it can access any user windows running in Session 0. However, starting with Vista, users never run in Session 0 anymore. FindWindow() only works in the context of the Session it is called in, as windows cannot be accessed across Session boundaries.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With