Two programs to receive keyboard input simultaneously?

In summary, ISBoxer can be used to control two programs at once. It has many features to help with this, including the ability to display all the UIs from all your clients on one screen.
  • #1
Juzernejm
2
0
Hi,

A tough one here. Does anyone know a way to control 2 or more programs simultaneously? i.e. give focus to two programs?

My brother wants to control two games (full screen), on the same PC, at once, I assume that he only needs one to be maximized at a time, but the trouble is giving focus to one will cut the keyboard off from the other, Any way he can make this work?
 
Technology news on Phys.org
  • #3
From within one program, you can open another one as a file descriptor and read and write to it.#include <cstdio> //<stdio.h> in C
FILE * fp = popen("yoursecondprogram --withargs", "w"); //write mode
if (fp == NULL) exit(1); //ERROR
fwrite(fp, 6, 1, "hello\r"); //Sends "hello" to the secondary program's stdin.

This is useful for proxying keyboard input, if you want things like key control for a game or something more real-time reactive, stdin is likely not what you want. You'll have to open up a socket communication between the two programs: The receiving program would have to open up a listening socket and the main program would have to send keyboard statuses through it. I have a similar issue right now where I want two different computers to control one two player game. I need a small helper program on the second computer to send commands over the network.
 
  • #4
Hi everyone! I have the same problem!
I found a program called Cheat Engine, you can use the hotkey option and freeze/pause every game by clicking any key.
I just have to turn on 2 Cheat Engines and select a hotkey for processes for 2 opened games. When I push the key it freezes two games at the same time, so I think it's possible to control it simultaneously. But there's a problem, There is no option for moving characters in the game, just freezing or changing values. so I have a question is there a program which will let me select a procceses and control games simultaneously? Sorry for my English
 
  • #5
Juzernejm said:
Hi,

A tough one here. Does anyone know a way to control 2 or more programs simultaneously? i.e. give focus to two programs?

My brother wants to control two games (full screen), on the same PC, at once, I assume that he only needs one to be maximized at a time, but the trouble is giving focus to one will cut the keyboard off from the other, Any way he can make this work?

For games use ISBoxer. It's purpose built for this.

http://isboxer.com/

It has a lot of features. For example it can chop up the game UI and display all the UIs from all your clients onto a separate screen.

Here's a guy playing 5 clients at once with ISBoxer

http://imgur.com/8IitCv1

Edited to change the screenshot. I just remembered that no-one who doesn'tplay Eve understands Eve screenshots ;-)
 
Last edited:
  • #6
Thanks Carno and everyone who tried to help me. ISBoxer is the solution of my problem.
 

1. How can two programs receive keyboard input simultaneously?

The simplest way to achieve this is by using a programming language that supports multi-threading or multi-processing. This allows the two programs to run simultaneously and receive input from the keyboard at the same time.

2. Is it possible to have two programs running in the background and still receive keyboard input for both?

Yes, it is possible. This can be achieved by using an event-driven or interrupt-based approach, where the keyboard input is constantly monitored and delivered to the appropriate program when triggered.

3. What happens if both programs try to access the keyboard input at the same time?

In this case, the operating system will prioritize and allocate the keyboard input to one of the programs. This can lead to a delay in receiving input for the other program, depending on the priority set by the operating system.

4. Are there any limitations to having two programs receive keyboard input simultaneously?

One limitation is that the two programs may share the same input buffer, which can lead to conflicts and incorrect input being received. This can be avoided by using separate input buffers for each program.

5. Is there a recommended approach for implementing two programs to receive keyboard input simultaneously?

It is recommended to carefully plan and design the implementation, taking into consideration the programming language and any limitations or conflicts that may arise. Consulting with experienced programmers or researching similar implementations can also be helpful.

Similar threads

  • Programming and Computer Science
Replies
2
Views
3K
  • Programming and Computer Science
Replies
11
Views
2K
  • Programming and Computer Science
Replies
21
Views
3K
  • Programming and Computer Science
Replies
29
Views
3K
  • Special and General Relativity
2
Replies
51
Views
2K
  • Special and General Relativity
Replies
20
Views
801
  • Computing and Technology
Replies
6
Views
7K
  • Programming and Computer Science
Replies
4
Views
1K
Replies
9
Views
3K
Back
Top