visual studio how i get window or program focus

  .net, c++, forms, visual-studio, windows

how i get program focus, i mean when i open google chrome windows it focus in google chrome and when i press any key on keyboard its only work in google chrome . when i go on desktop and i press any key its only work in desktop

I want to make a program that only works in a specific program that I specify. I want to call the program in which it is focused

example : i want to make low volume in program focus , when i press any key it slow volume

example 2 : if i want to close any program in focus, just i press key and it shutdown

im using visual studio windows forms C#
thank you for answer

Source: Windows Questions