C
C#4mo ago
yonog1

Service for saving images from clipboard

So I want to write a service for a friend that will save his screenshots from the snipping tool to a folder on hi PC. The reason that I'd prefer for it to be a service is that my idea is that this process will just start as he logs in and listens for copy events, then once such event is triggered, it checks if whats in the clipboard is a png and if it is, save it to some folder(on his desktop or whatever not too important). Im aware that you need a window context to access the clipboard on windows using the form library, but i wonder if theres a way to listen to those events without winforms so i can write this tool as a service. Any ideas?
6 Replies
Lukaa
Lukaa4mo ago
Clipboard Class (System.Windows)
Provides static methods that facilitate transferring data to and from the system Clipboard.
Lukaa
Lukaa4mo ago
Ah you wanna listen to changes , then I believe you need to use winapi
yonog1
yonog14mo ago
can you link some examples by any chance? i assuem this api mught be quite complex and what i need from it is relatively simple
Lukaa
Lukaa4mo ago
Create a Windows Clipboard Monitor in C# using SetClipboardViewer...
Custom Software and Database Developers for Microsoft .NET and SQL Server Programming Solutions - Rad Software
yonog1
yonog14mo ago
i think this requires a window context to access the clipboard and im looking to access the clpboard using a service which wont have any windows fuck it maybe ill just write it as a console app and figure out how to move that to the bg
br4kejet
br4kejet4mo ago
There doesn't have to be a visible window It can just exist while being hidden But almost everything runs through windows in windows