i want that my program communicate with other programs for example there are some programs that communicate with games make the game do something or there are some programs that make some changes in office how i can do that in C++
This always depends on the program you are to communicate with. Communication is something specially designed, so to make use of that you have to be aware of the design, except some trivial cases of one way communication by means of sending/posting Windows messages.
I wonder did you really read my message. You may want whatever you fancy, but the game will obey to only commands that it was programmed to. So, the first and the most interesting thing you are to do is figuring out what commands it was programmed to. Second and more trivial (or maybe not ), how to invoke the commands.
Please note, it's not about an abstract "a game" or "doing something", but it's always about specific software and specific commands.