FUNCTION CloseProgram >LPARAMETERS cWindowName >Local hMainWnd, hWnd, cWindowTitle >#define GW_CHILD 5 >#define GW_HWNDNEXT 2 >#define CRLF Chr(13)+Chr(10) > >DECLARE INTEGER GetDesktopWindow IN WIN32API >DECLARE INTEGER GetWindow IN WIN32API INTEGER, INTEGER >DECLARE INTEGER GetWindowText IN WIN32API INTEGER, STRING, INTEGER >DECLARE INTEGER IsWindowVisible IN WIN32API INTEGER >DECLARE INTEGER SetForegroundWindow IN WIN32API INTEGER >DECLARE INTEGER DestroyWindow IN WIN32API INTEGER > >hMainWnd = GetDesktopWindow() >hWnd = GetWindow(hMainWnd, GW_CHILD) >Do While hWnd > 0 > If IsWindowVisible(hWnd) <> 0 > cWindowTitle = Space(100) > GetWindowText(hWnd, @cWindowTitle, 100) > cWindowTitle = Trim(cWindowTitle) > cWindowTitle = Left(cWindowTitle, Len(cWindowTitle)-1) > If Upper(cWindowName) $ Upper(cWindowTitle) > =DestroyWindow(hwndNext) > Exit > EndIf > EndIf > hWnd = GetWindow(hWnd, GW_HWNDNEXT) >EndDo>ENDFUNC
=SetForegroundWindow(hwndNext)
>Keyboard '{ALT+F4}'
>*****************
>This one closes my program only :-) What am I missing here? Thanks for your valuable time and response.
>
>Regards
>VijayEMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater
NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC
The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys