Important: Please read the Qt Code of Conduct -

QClipboard and Windows service

  • I have created a program that monitors the clipboard for an image and it works fine, if only that where the end of it.

    However I am required to have this programming running as a windows service and the code that works fine in the user environment doesn't work when setup as a service.

    The connect function for the clipboard returns true when setting up the signal for the dataChanged function however the slot is never called when the clipboard data changes.

    Can anyone with a more in depth knowledge of Qt offer any help as to why the windows service version would not work when a standard executable does and furthermore if it's possible to get the service to work as intended.

    Thanks for any help you can provide.

  • System services use a special user Account (actually there are several special user accounts for services) and they also run in a separate "none interactive" session, which is pretty much shielded from the user's "interactive" session. For example, you cannot create/show GUI dialogs from a system service on modern Windows (Vista+). So I guess that's also the reason why you cannot access the Clipboard. If the service session does have a clipboard at all (which I'm not so sure), it will be a separate one from the user's.

    I guess you will need to run a "background" task (like a "tray icon" app) inside the user's session as a regular application to interact with the clipboard. This application can then send the data to the system service...

  • Thanks for the reply, I have had this trouble before with services and had to implement a separate program to give the user some feedback when an error has occurred. I was thinking i'd have to do the same with this problem I'm reasonably new to Qt so I wanted to check with some more experienced users to see if this was my only option or if there's any way to get the QClipboard to pickup this clipboard activity.

Log in to reply