asmcmrr
asked on
Shell an external app, return focus to VB app form when it closes
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 ;-) ]
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 ;-) ]
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I tried this and it works perfectly. I had to switch over to using VB's internal Shell instead of the ShellExecute API call though, it would be ideal if I could continue using ShellExecute, so that any registered file type could be executed without knowing the location of their parent EXE and I could specify a default directory. (e.g. this would be good for Visual PinMAME pinball tables)
That's the only reason it isn't an "A".
Thanks a lot,
ASM
That's the only reason it isn't an "A".
Thanks a lot,
ASM
ASKER