Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
HProcess?
Message
From
06/05/2000 15:29:23
 
 
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Title:
Miscellaneous
Thread ID:
00366864
Message ID:
00366995
Views:
19
>>How can I get the hProcess of a FoxPro running exe?
>>
>
>If you're talking about the current execution context, GetCurrentProcess() should work - otherwise, you have to search the set of running processes to find the ProcessID and use OpenProcess() to retrieve a handle with the needed privileges.

How do you search the set of running processes?

This has definitely been a research project. We found about GetCurrentProcess, but I originaly was trying to set the thread priority instead of the PriorityClass which was not working. I also assumed that getting a -1 for a process handle meant that I had an invalid handle. Later when trying to set and reset the priority I didn't have problems.

>>I need the program to reset its own priority.
>>
>
>If you do not understand the consequences and mechanisms of adjusting the priority of a process you are exceedingly likely to hurt yourself. I'll lay very heavy odds that since you don't know about GetCurrentProcess() you are odds on to mangle Windows a few times.

I am curious, as to how Windows would get mangled when changing the Process priority.

>Do yourself a favor; try launching the unzip process via CreateProcess() and use the dwCreationFlags value to adjust the priority when you start the process - see the MSDN Library entry on CreateProcess, and look in detail at the dwCreationFlags parameter values for the MSDN Library entry on CreateProcess(). Let the parent process set it.

Actually in this instance to be of any use the program has to start with a low ( actually idle ) process priority because the majority of the Unzip process is slow enough to bring the web server to its knees. This is why the web hit for unzipping hands off to another process which has a low priority.

Once the process, has done most of its work, there is an issue of swapping tables which are in use by many of the web processes. At this point we shut all process by using West-wind's HoldRequests. We wait to get exclusive use of a specific file that will only be available to us when everyone is out. Now we kick the process priority up to normal and the swapping takes place. This should be very brief.

Finally the program reloads the servers by issuing a Load and we kick back the process priority to idle.

If this approach is going to give us more problems then its worth, then we'll have to leave the Process Priority alone.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform