set library to (home()+'foxtools.fll') && for use of MainHwnd() myhwnd = MainHwnd() && obtain HWND for VFP main window run /n explorer.exe /e,/select,c:\ && launch Explorer against c:\ * pause long enough for the Explorer window to open DECLARE Sleep IN kernel32 INTEGER dwMilliseconds sleep(500) DECLARE INTEGER SetForegroundWindow IN user32 INTEGER hwnd ? SetForegroundWindow(m.myhwnd) && try to bring VFP back to foregroundInstead of activating the VFP window at this point, its taskbar button starts flashing. I've tried lots of programmatic ways to get the focus to return to VFP, and the "best" I've been able to do so far is to use the following kludge instead of SetForegroundWindow:
#define SW_MINIMIZE 6 #define SW_RESTORE 9 DECLARE INTEGER ShowWindow IN WIN32API INTEGER, INTEGER ? ShowWindow (m.myhwnd, SW_MINIMIZE) && minimize the VFP window ? ShowWindow (m.myhwnd, SW_RESTORE) && restore to normal zoom stateThis works, but obviously it's a rather clunky approach. A search of Google Groups for "SetForegroundWindow" yields a huge number of hits about similar problems. I picked up the ShowWindow MINIMIZE/RESTORE hack from one of these threads, but it's exhausting to wade through all of these references. Has anyone found a better solution that would work for this example under Windows 2000? Please test to confirm if you think so. TIA for any help.