Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Kill a process
Message
 
À
29/03/2004 14:36:28
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Titre:
Divers
Thread ID:
00890217
Message ID:
00890570
Vues:
25
>>>>seems to be what I need but I got the following error
>>>>
>>>>too many arguments
>>>>
>>>>
>>>>    DECLARE SHORT GetExitCodeProcess IN WIN32API AS GetExitCodeProc ;
>>>>        INTEGER hProcess, ;
>>>>        @INTEGER lpdwExitCode
>>>>    LOCAL nRetunCode
>>>>    nReturnCode = 0
>>>> 	
>>>>    IF GetExitCodeProc(tnProcessToCheck, @nReturnCode)  && HERE HERE
>>>>
>>>
>>>Hi Selim,
>>>
>>>The declaration is wrong. It should be no '@' in front of INTEGER
>>>
>>>
>>>    DECLARE SHORT GetExitCodeProcess IN WIN32API AS GetExitCodeProc ;
>>>        INTEGER hProcess, ;
>>>        INTEGER lpdwExitCode
>>>
>>>    IF (GetExitCodeProc(tnProcessToCheck, nReturnCode) != 259)
>>>
>>>Also, for NT based system when you want to terminate a process, you must first open the process and set permission to terminate then you can terminate it.
>>
>>Herman,
>>
>>I think you've still got it wrong. See Re: Acrobat/AcroRd.exe never kill process when closed Thread #888048 Message #888113 for illustration of correct declaration and usage of GetExitCodeProcess.
>>
>>Mike
>
>
>
>Ooopss sorry. I didn't looked into the code I have <*g*>
>You right. This is mine:
>
>   Declare Long GetExitCodeProcess in Kernel32 ;
>      Long hProcess, Long @nExitCode
>
>   ll_Error = (GetExitCodeProcess(ln_hProcess, @ln_ExitCode) == 0)
>   If !ll_Error and (ln_ExitCode != 259)
>      *** Do something
>   endif
>
>
>Btw, I have looked into your code. I don't think it will wait if Acrobat is already running. Have you try that ?

Yes, Herman, I realized that Tracy's code wouldn't work if Acrobat were already running, as I mentioned in Re: ShellExecute WaitForSingleObject IsRunning(GeorgeTasker) Thread #887963 Message #888036. The issue I was addressing had to do with a flakyness in WaitForSingleObject, even without the complication of a prior instance of Acrobat. For some unknown reason, WaitForSingleObject left Acrobat process residue, but this was circumvented by substituting an essentially equivalent (I thought) piece of code that uses GetExitCodeProcess.

Mike
Montage

"Free at last..."
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform