给你段代码,你看看用不用得上。。。

程序代码:
*-- VFP Code
#Define GW_NEXT 2
#define GW_CHILD 5
Declare Integer GetActiveWindow In user32
Declare Integer GetWindow In win32api Integer HWnd, Integer wFlag
Declare Integer GetWindowTextA In win32api Integer hwnd, String @ctitle, Integer ntitle
Declare Integer SetForegroundWindow In Win32api Integer
DECLARE inte IsChild IN WIN32API integer Hwndparent,integer Hwnd
Declare inte FindWindowEx IN win32api inte hWnd1,inte hWnd2, string lpsz1, string lpsz2
Declare Integer GetWindowText In win32api Integer hand, String @ctitle, Integer ntitle
clea
*hcurrent=findwindowex(_vfp.hwnd,0,null,null)
hcurrent=findwindowex(0,0,null,null)
*?hcurrent
*hCurrent=GetActiveWindow() &&从当前活动窗口开始
*lnhCurrent=hCurrent
*SetForegroundWindow(_vfp.HWnd)
*SetForegroundWindow(_Screen.HWnd) &&或Thisform.HWnd
*SetForegroundWindow(hCurrent) && vfp8 以下没有 HWnd
*lcWinLists=""
Create Cursor t1 (WindowHWnd I,WindowTitle C(254))
Do While hCurrent!=0
lcWinTitle=Space(255)
lnlength=GetWindowTextA(hCurrent,@lcWinTitle,Len(lcWinTitle))
lcwintitle=SUBSTR(lcwintitle,1,lnlength)
*lcWinTitle=Iif(lnlength>0,Strtran(Trim(lcWinTitle),Chr(0),""),"")
Insert Into t1 Values (hCurrent,lcWinTitle)
*hCurrent=findwindowex(_vfp.hwnd,hcurrent,null,null) &&得到下一个窗口句柄
hCurrent=findwindowex(0,hcurrent,null,null) &&得到下一个窗口句柄
*?ischild(_vfp.hWnd,hcurrent)
*?hcurrent
Enddo
*SetForegroundWindow(lnhCurrent)
Select t1
*Locate
Browse
*Clear Dlls