Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Detecting launched application after ShellExecute
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00421895
Message ID:
00421968
Vues:
17
Darwin,
>
>I am having a hard time finding out what is the right API function that will detect if the application ('WinZip') I have launched using 'ShellExecute' is still running or not.
>
>The returned handle by 'ShellExecute' is that of its parent window, not the instance of the launched application. I doubt if GetWindowText could do the job since its possible to have multiple instances of the same application('WinZip').

No, it is not the window handle. From the Platform SDK:

Returns a value greater than 32 if successful, or an error value that is less than or equal to 32 otherwise. The following table lists the error values. The return value is cast as an HINSTANCE for backward compatibility with 16-bit Microsoft® Windows® applications. It is not a true HINSTANCE, however. The only thing that can be done with the returned HINSTANCE is to cast it to an integer and compare it with the value 32 or one of the error codes below.

IOW, it's not good for anything other making sure that the application was successfully launched.


>I need this 'Function' to prevent my other codes from executing while the launched application is still running.

Look at Ed Rauh's API_APPRUN in the Files section under Win32 and other APIs.

Another solution is to use the WScript.Shell object exposed by the Windows Script Host. It has a Run method that allows the caller to wait until the launched application to finish. Ed and I discuss the uses of this object in the October issue of the VFUG newsletter, which is available on-line at www.vfug.org. In the September issue, we discuss how to tell if the WSH is installed and how to get it.
George

Ubi caritas et amor, deus ibi est
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform