Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Determine if process is running in Windows NT
Message
De
13/02/2004 16:57:51
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Titre:
Determine if process is running in Windows NT
Divers
Thread ID:
00877304
Message ID:
00877304
Vues:
64
I want to determine if Apache server if running in Windows NT.
I try to use Nadya Nosonovsky code from 04/12/2002 Message ID:729491

?ProcessIsRun('Apache')

In Windows NT 4.0 DECLARE command in this code causes error

cannot find entry point CreateToolhelp32Snapshot in the dll

How to create a code which works in NT also ?
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(lcProcName) 
lppe = CHR(44) + CHR(1) + REPLICATE(CHR(0), 298) 

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

Do WHILE lnRetCode <> 0 
 If lcProcName $ UPPER(SUBSTR(lppe, 37, 256)) 
   lnRetCode = 1 
   Exit 
   Endif 
  lnRetCode = Process32Next(lhSnapshot, @lppe) 
  Enddo 
CloseHandle(lhSnapshot) 
Return lnRetCode
Andrus
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform