Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Determine if process is running in Windows NT
Message
From
13/02/2004 16:57:51
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Title:
Determine if process is running in Windows NT
Miscellaneous
Thread ID:
00877304
Message ID:
00877304
Views:
65
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
Next
Reply
Map
View

Click here to load this message in the networking platform