Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Returning PID's from TASKMGR
Message
 
 
To
04/06/2001 19:49:57
General information
Forum:
Visual FoxPro
Category:
Client/server
Miscellaneous
Thread ID:
00514900
Message ID:
00515087
Views:
16
>I need some help! I have a client/server application where users can submit jobs to run in background(on the server). The application running on the server has to have a way to control the number of executes that fire. I am trying to come up with a way to interrogate the TASKMGR on the server and return the PID of the instances of the executes and be able to discern when an execute finishes so I can control the number of executes. At present a shell execute is used to fire the secondary exe. I can only see a status value of the shell execute and not the PID. If anyone out there has had a similar need and has a solution, I would greatly appreciate a heads up on how this can be done.

William,
Under NT/2000, you can use the EnumProcesses WinAPI function. Ex.
declare integer EnumProcesses in psapi.dll string@, integer, integer@
lparray = replicate(chr(0),2048)
lnsizeneeded = 0
if EnumProcesses(@lparray,len(lparray),@lnsizeneeded) <> 0 then
   * lnsizeneeded is the size (in bytes) of the information returned in lparray; truncate if necessary
   lparray = left(lparray,lnsizeneeded)
   lctmp = space(0)
   for lxx = 1 to lnsizeneeded step 4
      lctmp = substr(lparray,lxx,4)
      * lctmp is a character reprentation of the DWORD representing the Process ID.  It needs to be converted to decimal.
      ? 'PID is ' + transform(asc(right(lctmp,1))*(256^3)+;
	asc(substr(lctmp,3,1))*(256^2)+;
	asc(substr(lctmp,2,1))*(256)+asc(left(lctmp,1)))
   endfor
endif
HTH.
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Previous
Reply
Map
View

Click here to load this message in the networking platform