local loWindows loWindows = PopupWin() ... loIE.Navigate("<url>") ... release loWindowSave this code to PopupWin.prg
* Program: POPUPWIN.PRG * Description: Unloads Popup windows * Created: 08/29/2006 * Developer: Gregory L Reichert - UT #046387 * Copyright: Copyright (c) 2006 *------------------------------------------------------------ *------------------------------------------------------------ * Description: * Parameters: <para>, <req/opt>, D=<def>, <desc> * Return: * Use: *------------------------------------------------------------ * Id Date By Description * 1 08/29/2006 Gregory L Reichert Initial Creation * *------------------------------------------------------------ RETURN CREATEOBJECT("PopUpWindows") DEFINE CLASS PopUpWindows AS CONTAINER DIMENSION aWindows[1,2] *------------------------------------------------------------ * Description: Remember all currently open windows. * Parameters: <para>, <req/opt>, D=<def>, <desc> * Return: * Use: *------------------------------------------------------------ * Id Date By Description * 1 08/29/2006 Gregory L Reichert Initial Creation * *------------------------------------------------------------ PROCEDURE INIT *------------------------------------------------------------ * Description: build list of window hwnd * Parameters: <para>, <req/opt>, D=<def>, <desc> * Return: * Use: *------------------------------------------------------------ * Id Date By Description * 1 09/04/2003 Gregory L Reichert Initial Creation * 2 02/04/2004 GLR dont clear DLL, may be needed in actual application. *------------------------------------------------------------ LOCAL HWND, x,N, stuffer * Get the HWND (handle) to the main FoxPro window #IF VERSION(5)>=700 HWND = _VFP.HWND #ELSE IF FILE(HOME()+"FoxTools.fll") SET LIBRARY TO (HOME()+"FoxTools.fll") ADDITIVE HWND = EVALUATE("MainHWND()") RELEASE LIBRARY (HOME()+"FoxTools.fll") ELSE RETURN .F. ENDIF #ENDIF * Register the Windows API functions that will be called DECLARE INTEGER GetWindowText IN WIN32API; INTEGER HWND, ; STRING @ lpString, ; INTEGER nMaxCount DECLARE INTEGER GetWindow IN user32; INTEGER HWND,; INTEGER wFlag N = 0 DO WHILE HWND <> 0 stuffer = REPLICATE(CHR(0),512) x = GetWindowText(HWND,@stuffer,511) stuffer = LEFTC(stuffer,AT_C(CHR(0),stuffer)-1) IF LEN(TRIM(stuffer)) > 0 N = N + 1 DIMENSION THIS.aWindows[ n, 2] THIS.aWindows[ n,1 ] = HWND THIS.aWindows[ n,2 ] = stuffer ENDIF HWND = GetWindow(HWND,2) ENDDO RETURN ENDPROC *------------------------------------------------------------ * Description: closes window not previously openned * Parameters: <para>, <req/opt>, D=<def>, <desc> * Return: * Use: *------------------------------------------------------------ * Id Date By Description * 1 08/29/2006 Gregory L Reichert Initial Creation * *------------------------------------------------------------ PROCEDURE DESTROY LOCAL HWND, x,N, stuffer, lFound * Get the HWND (handle) to the main FoxPro window #IF VERSION(5)>=700 HWND = _VFP.HWND #ELSE IF FILE(HOME()+"FoxTools.fll") SET LIBRARY TO (HOME()+"FoxTools.fll") ADDITIVE HWND = EVALUATE("MainHWND()") RELEASE LIBRARY (HOME()+"FoxTools.fll") ELSE THIS.lclosepopup = .F. RETURN ENDIF #ENDIF * Register the Windows API functions that will be called DECLARE INTEGER GetWindowText IN WIN32API; INTEGER HWND, ; STRING @ lpString, ; INTEGER nMaxCount DECLARE INTEGER GetWindow IN user32; INTEGER HWND,; INTEGER wFlag DECLARE SHORT PostMessage IN user32; INTEGER HWND,; INTEGER Msg,; STRING @ wParam,; INTEGER LPARAM DO WHILE HWND <> 0 stuffer = REPLICATE(CHR(0),512) x = GetWindowText(HWND,@stuffer,511) stuffer = LEFTC(stuffer,AT_C(CHR(0),stuffer)-1) IF LENC(TRIM(stuffer)) > 0 lFound = .F. FOR N=1 TO ALEN(THIS.aWindows,1) lFound = lFound OR (HWND==THIS.aWindows[n,1] ; AND stuffer==THIS.aWindows[ n,2 ] ; AND NOT LEFTC(stuffer,22)="Visual FoxPro Debugger") IF lFound EXIT ENDIF NEXT IF NOT lFound *-- popup window, close it. ACTIVATE SCREEN PostMessage(HWND, 0x10, 0, 0) ENDIF ENDIF HWND = GetWindow(HWND,2) ENDDO RETURN .T. ENDPROC ENDDEFINEP.S. I sent a copy of you LOCALS.prg to Bhavbhuti to help him a problem he was having today. I added code to have it see existing Private, Dimension, and Public statements.