Switching active display window
Malcolm Harrow

I'm porting an Allegro 4 program to Allegro 5. Some details are here:

http://www.stardot.org.uk/forums/viewtopic.php?f=44&t=9065

This is an emulator for a 1980s home computer called the Acorn Atom. The original program allows you to set a breakpoint so that when the emulator hits a certain memory address, the emulator pauses and a debug console is opened.

I can't quite get this to work in Allegro 5. What I need is a way to force a switch of focus from one window (display) to another. i.e. from the display running the emulated computer into the debug console.

At the point I want to switch the display, I've tried things like al_resize_display() and al_set_window_position() to try to change the focus but with no luck.

Any ideas or suggestions ?

Malcolm

Edgar Reynaldo

On Windows, you can use the following code :

#include "windows.h"

//...

   SetForegroundWindow(al_get_win_window_handle(display));

Thread #616208. Printed from Allegro.cc