Shell an external app, return focus to VB app form when it closes
Posted on 2003-03-14
I'm writing a frontend program in VB5 for a Win98 system which won't use a mouse, only very basic keystrokes made by a special joystick (mainly : left [arrow], right, down, up, spacebar). My frontend EXE is used as the Win98 shell instead of EXPLORER.EXE, and the user is presented with a form populated with a grid of command buttons which correspond to certain programs (games). Users can navigate the grid of command buttons with the joystick (left, right, etc are mapped as keystrokes), and select the game they want to shell (via API call "ShellExecute") by hitting the joystick button mapped to send the spacebar key. Once the game has been played and exited, focus *should* return to the VB app's form so that the user can navigate through the command buttons and select another game.
The problem I'm having is that some games don't return focus to the VB app once they exit. If I run my VB app with EXPLORER.EXE as the shell, I can see that the games in question leave a "blank" (no title or icon) entry in the Windows task bar. Clicking the "blank" entry will make it disappear.
Can I use VB to return focus to itself once one of these "rogue" games exits? Even if the answer is a Windows one instead of VB, I'm just looking for an answer. [ not including adding extra input keys or a mouse to the system ;-) ]