Guess I could do with VFP7! I just can't get it to detect the window! Here is the code - I wondered if you could see any problems with it?
DECLARE INTEGER FindWindow IN Win32API;
STRING @lpClassName, ;
STRING @lpWindowName
lcApplicationTitle = (oApp.AppTitle + oApp.FormCaption)
*!* wait window "Caption " + (lcApplicationTitle)
lnHWnd = FindWindow(0, @lcApplicationTitle)
*!* wait window "Handle " + str(lnHWnd)
DECLARE SHORT SetForegroundWindow IN USER32.DLL INTEGER lnHWnd
* I assume you've got the hWnd you want stored in the variable nhWnd
IF SetForegroundWindow(lnHWnd) # 0
* the desired window and thread are now in the foreground
wait window "Success"
ELSE
wait window "Failed"
* the hWnd was not assigned to the foreground and the thread
* remains at its default priority
ENDIF