Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Is it possible to cancel the process which is pending?
Message
 
 
À
14/11/2000 09:03:23
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00440138
Message ID:
00441700
Vues:
21
>>>>Is it possible to cancel the COM DLL/EXE process which is pending?
>>>
>>>SInce you didn't get any replies, I'll bite? Do you mean programmatically cancel a method? If so, you'll want to anticipate it, and search for a file or property or something to trigger it then have it cancel itself.
If "pending" means not responding, etc. then there is a WIn32 solution using:
>>
>>GetWindowThreadProcess
>
>Not to be nitpicky, but it's GetWindowThreadProcessId
>
>>OpenProcess
>>SendMessageTimeout
>>TerminateProcess
>>
>
>TerminateProcess is a rather extreme measure; it's often better to try using PostMessage() to send a WM_QUIT to the thread's message queue first, and allow it to time out a couple of times and repeat the process. TerminateProcess does kill the running process, but it doesn't give the app a chance to clean up after itself; anything it holds in buffers is probably toast, and it will leave any DLLs it has open in an indeterminate state, and won't decrement their usage counter, so they won't unload properly after that. The MSDN docs strongly suggest that you terminate the Windows session after calling TerminateProcess in order to get things through as orderly a shutdown as possible as quickly as possible; leaving system DLLs that serialize access to them using the CriticalPath and Mutex mechanisms will leave things 'locked out' if the terminated process had the controlled block active when summarily terminated with extreme prejudice.
>
>>The SendMessageTimeout allows one to verify that the app (exe) has hung (or is ").
>
>SendMessageTimeout() is notorious for not detecting VFP in a compute-intensive environment (that's why TaskMan often shows VFP "Not Responding" when it's running a long query; VFP suspends repsonding to Windows Messages at times, particularly in the context of a single line of code that takes considerable time to execute, or a tight loop that does no UI operations and doesn't make a call to an outside procedure or method.
Thanks, Ed,
I'll try harder not to miss the "ID" next time. Also, I'll assume that your elaboration is for the benefit of anyone that might try to follow my suggestion - since I did state that this was conditional upon "pending" meaning not responding. I'm also already aware that the Task Manager can display "Not responding" for a VFP app that is "very very busy". I guess next time I'll have to be more explicit and detailed in answers of this sort.
censored.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform