Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Find a running process
Message
 
 
À
16/11/2004 23:08:31
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Versions des environnements
Visual FoxPro:
VFP 6
OS:
Windows 2000
Network:
Windows 2000 Server
Database:
Visual FoxPro
Divers
Thread ID:
00962019
Message ID:
00962032
Vues:
8
>How can I get a list of running programs (as shown in the task manager)
>from within my VFP application. If a specific program is running, I could use this information to altre the processing of my application.
>
>Is there a specific WinAPI call I could use to find if a specific exe is running.

Victor,

I have the following function in my library, but unfortunately it doesn't have an author (I believe, I took it from Russian site):
function ProcessIsRun
lparameters lcProcName

declare integer CreateToolhelp32Snapshot in Win32api integer dwFlags, integer th32ProcessID
declare integer Process32First in Win32api integer lhSnapshot, string lppe
declare integer Process32Next in Win32api integer lhSnapshot, string lppe
declare integer CloseHandle in kernel32 integer hObject

local lnRetCode, lppe, lhSnapshot

lcProcName = upper(m.lcProcName)
lppe = chr(44) + chr(1) + replicate(chr(0), 298)

lhSnapshot = CreateToolhelp32Snapshot(2, 0)
lnRetCode = Process32First(m.lhSnapshot, @lppe)

do while lnRetCode <> 0
	if m.lcProcName $ upper(substr(m.lppe, 37, 256))
		lnRetCode = 1
		exit
	endif
	lnRetCode = Process32Next(m.lhSnapshot, @lppe)
enddo

CloseHandle(m.lhSnapshot)

return m.lnRetCode
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform