Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Terminating a suspended VFP EXE win32api
Message
From
08/01/2003 16:29:07
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00739544
Message ID:
00739566
Views:
14
>Can we programmatically KILL a known WindowHandle and WindowTitle application (to terminate immediately)?
I modified the following from George so that it kills an application identified by pctitle. I just saved it as a prg named killer and call it with DO killer.prg WITH 'Accessory'(kills applications being run by accessory manager)
HTH
Sammie
* FUNCTION: Is_Run32.prg
* AUTHOR: George Tasker
* DATE: January 13, 1998 - 8:26 AM
* PURPOSE: Determines if a Windows
* application is running and returns
* the handle of the window if it is,
* otherwise returns 0. 32 bit version
* for Windows 95/NT 3.51-4
LPARAMETER pctitle
* Parameter list description
*
* pctitle - The title bar of the Window
* Note: The title does not have to be
* the complete title that appears
*
*
* API Declarations

DECLARE INTEGER GetActiveWindow IN Win32API
DECLARE INTEGER GetWindow IN Win32API;
INTEGER HWND, INTEGER dflag
DECLARE INTEGER GetWindowText IN Win32API ;
INTEGER HWND, STRING @lptstr, INTEGER cbmax
LOCAL lnhwnd, lnnext, lldone, lctitle_bar, lcsearchfor,;
lntext_len

lcsearchfor = UPPER(ALLTRIM(pctitle))
lnhwnd = GetActiveWindow()
lnnext = 2
lldone = .F.
lctitle_bar = ""
DO WHILE NOT lldone
IF NOT EMPTY(lnhwnd)
lctitle_bar = SPACE(200) + CHR(0)
lntext_len = GetWindowText(lnhwnd, @lctitle_bar, 200)
lctitle_bar = UPPER(LEFT(lctitle_bar, lntext_len))
lldone = (lcsearchfor $ lctitle_bar)
IF NOT lldone
lnhwnd = GetWindow(lnhwnd, lnnext)
ENDIF
ELSE
lldone = .T.
ENDIF
*!* ?lctitle_bar
ENDDO
DECLARE SendMessage IN Win32api;
INTEGER h, INTEGER wm, INTEGER a, INTEGER b
SendMessage(lnhwnd,4,0,0)
RETURN lnhwnd
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform