I am currently working on a programmable keyboard, based on an Arduino. The C# program gets the information which key is pressed via USB. Until now I am able to open programs, using shortcuts, ...
As an addition I want to have different key-bindings for different programs. To get this working I have to get a specific detail from the active program, like the name of the exe file.
While searching I have found out, that I can get the active window with the GetActiveWindow
function and I know, that I have to use another Windows function, but I haven't found out which one.
I was able to get the header text of the window, but this text was for example different for each open Word document, so I couldn't use this.
Anyone have a clue which function I can use, to get something specific to compare with an if statement, like this:
string activeProgram;
...
if(activeProgram=="Word"){...}
else if(activeProgram=="Chrome"){...}