Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
OLE Status unknown problem...
Message
 
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00496654
Message ID:
00496824
Views:
43
>>In what way's does it get trickier? Is it because we need information on the task that is difficult to find?
>
>It's because you need to pass TerminateProcess() a handle to the process you want to kill, and getting that handle isn't easy. It involves a bit more code than just
RUN kill.exe 1407
.

You mean like:
lparameters tcwindow
#define PROCESS_TERMINATE 0x1
local lnhwnd, lnprocID, lnhproc
declare integer GetLastError in win32api
declare integer FindWindow in user32 string, string
declare integer GetWindowThreadProcessId in user32 integer, integer@
declare integer OpenProcess in kernel32 integer, integer, integer
declare integer TerminateProcess in kernel32 integer, integer

lnhwnd = FindWindow(0,tcwindow)

if lnhwnd <> 0 then
	lnprocID = 1
	GetWindowThreadProcessId(lnhwnd, @lnprocID)
	lnhproc = OpenProcess(PROCESS_TERMINATE,0,lnprocID)
	if lnhproc <> 0 then
		lnretval = TerminateProcess(lnhproc,99)
		if lnretval = 0 then
			? GetLastError()
		endif
	endif
endif
return
Just a few more lines of code. :-)
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform