-1

I have a ProcessCmdKey function in my script and I need it to run even when the application is not being focused on. I am also hiding the application and removing its icon from the taskbar because I want it to run in the background. It also starts up when the computer starts up.

Sol
  • 21
  • 1
  • 5
  • 1
    Your question has a low quality or what you asking for is unclear or too broad. What is your goal? What is your difficulty? What have you done so far? Please try to better explain your issue, your dev environment and the data structure as well as to share more code or some screenshot of your screeen or your scenario. To help you improve the content, title and tags of your query, consider reading the *[How do I ask a good question](https://stackoverflow.com/help/how-to-ask)* which is in the help center. –  Oct 05 '19 at 04:45
  • _"...and `I need it to run` even when the application `is not being run`..."_ - say what?? –  Oct 05 '19 at 04:47
  • Sorry, I meant to say "I need it to be run even when the application is not being focused on." – Sol Oct 05 '19 at 04:48
  • No need for a Windows Service, just create a keyboard hook to intercept keyboard events. –  Oct 05 '19 at 04:50
  • Ok thanks, and sorry for my mistake – Sol Oct 05 '19 at 04:51

2 Answers2

0

I ended up using keyboard hooks which were recommended to me by MickyD.

Sol
  • 21
  • 1
  • 5
-1

You can use Windows Service instead of ProcessCmdKey to run in background even when your application is not running and set startup type of service to automatic mode to start running when windows start.

For creating and installing maybe this link is useful for you:

Amir Azad
  • 113
  • 5