2

Environment

  • ASP.NET Core Application with Kestrel hosted as Windows Service using .Net Core 2.2
  • Angualar Application which is delivered through the ASP.NET application
  • Web API for communicating between the ASP.NET and Angular application
  • Everything is running on one Windows PC. The Angular application will always be only available on localhost

Use Case

A user makes a screenshot of a WPF application also running on the same PC using the print key. The ASP.NET application needs now a trigger, that a screenshot was made so it can be send to the angular application.

Solution approach

I thought that I would just listen with a global hook for the print key and then get the image from the clipboard. I've tried using the low level Windows API and different Nuget packages (for example this one). Either nothing happened or the application froze.

Question

Is there a way listening globally for the key press of the print key in .Net Core 2.2 application or is there another approach I can listen for new screenshots made by the user?

Niklas
  • 417
  • 6
  • 17
  • 1
    This will be because your service is isolated from the user and is going to end up hooking it *own* desktop, See https://stackoverflow.com/questions/5815424/global-keyboard-hook-from-windows-service – Alex K. Mar 27 '19 at 16:22
  • Why would you even consider such a hilarious setup instead of just starting an WPF/Windows Form application that runs minimized and does the same w/o angular and just a WebAPI in the background? Even Electron + Angular or something else would make far more sense, than to abuse an ASP.NET Application for that – Tseng Mar 27 '19 at 18:31
  • I know it sounds stupid, but this setup is just part of a much bigger application where many teams work on. It had many reasons I cannot tell here, because of NDA, why we chose this architecture. – Niklas Mar 28 '19 at 06:23
  • @Tseng how can we achieve similar thing with Electron + Angular ? Can we listen with a global hook in Electron + Angular ? – Sachin Feb 19 '20 at 14:12
  • @Niklas have you find any solution ? if you can you please share here.. thanks in advance .. – Sachin Feb 19 '20 at 14:13

0 Answers0