Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Determine if process is running in Windows NT
Message
 
 
To
13/02/2004 16:57:51
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00877304
Message ID:
00877316
Views:
13
Andrus,

The CreateToolhelp32Snapshot API function is not supported under WinNT.

>I want to determine if Apache server if running in Windows NT.
>I try to use Nadya Nosonovsky code from 04/12/2002 Message #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
>
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform