This doesn't do everything you need, but prehaps it will get you started...
PARAMETERS cWindowName
*NOTE - The window name must be an exact match to the target window's title, but is not case sensitive.
*For example, if you have Outlook open and you are viewing the Inbox the
*title is "Inbox - Microsoft Outlook", otherwise this utility will not locate
*the appropriate window.
DECLARE Long FindWindow IN "user32" String, String
Declare Long SetActiveWindow IN "user32" Long
Declare Long SetForegroundWindow IN "user32" Long
strTemp=.null.
lngHandle=0
lngHandle = FindWindow(.null., cWindowName)
IF lngHandle>0
SetForegroundWindow(lngHandle)
SetActiveWindow(lngHandle)
ENDIF
>Hi Everyone,
>
>Anybody know how to set focus or activate the program that is already shown in the taskbar.
>
>Basically, what I wanted to do is that in my program, I have a button such that when the user presses it, it will bring up the Outlook. If the Outlook is already running, I don't wanted to run the 2nd instance of an Outlook. I just wanted to set the currently running Outlook window into maximize and set the current focus to Outlook as the currently selected program. And when he closes the Outlook, it will return the focus to my program.