2

We have a desktop application written in PyQt (let's call it OUR) that adds complementer functionality to an existing proprietary MS Windows application (named THEIR). THEIR runs fullscreen. We would like to switch to OUR and then back to THEIR programmatically when an external (hardware) event happens. Something like if we were to emulate the key combination ALT-TAB from OUR.

How can we switch to THEIR from OUR? How can we switch to OUR from THEIR on an event - for example when a timer times out?

Gergely Máté
  • 107
  • 2
  • 11

1 Answers1

0

How much control do you have over THEIR program and the hardware event? Generally, the only way to raise windows in another application is to get a handle to them through the window manager and raise them. The method will depend on what OS and window manager you're using. On windows, you can use the pywin32 api.

One method would be to create a small daemon process that functions as a socket server or xmlrpc server (python has easy ways to implement both). When either OUR or THEIR wants to raise the other window, they would send a message to the daemon, which would raise the appropriate window. The daemon process could also monitor the OS for events and raise windows on it's own.

Brendan Abel
  • 35,343
  • 14
  • 88
  • 118
  • Thanks, Brendan! Although meanwhile our project took another direction, for the problem up here the method accessing other windows by handles to them requested from the OS seems promising! I checked out `pywin32` briefly, but I did not find detailed (or any) documentation for it (maybe I was too brief). I'm a bit afraid that in order to implement this, I would need to know the win32 API in depth, which I don't. Luckily this feature is cancelled now. – Gergely Máté May 20 '16 at 08:13