Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Delete a running process
Message
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows 2008 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01344979
Message ID:
01345012
Views:
14
Hi,

You can use the PID of your program to avoid killing it, modifying the code you posted in your other post
declare integer GetCurrentProcessId in WIN32API
lnMyProcess = GetCurrentProcessId()
loCIMV2	= GetObject('winmgmts://' + tcComputer + '/root/cimv2')
IF TYPE('loCIMV2') = 'O'
	*!* Check for scanners servers that weren't closed last time program was closed
	loProcesses	= loCIMV2.ExecQuery("SELECT * FROM Win32_Process WHERE Name = 'frtasktimetrack'")
	IF loProcesses.Count > 0
		For Each objProcess in loProcesses
			if objProcess.ProcessId  # lnMyProcess
				objProcess.Terminate(0)
			endif
		NEXT
	ENDIF
ENDIF	
"The five senses obstruct or deform the apprehension of reality."
Jorge L. Borges?

"Premature optimization is the root of all evil in programming."
Donald Knuth, repeating C. A. R. Hoare

"To die for a religion is easier than to live it absolutely"
Jorge L. Borges
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform