Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to determine if an external app is running!
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00034052
Message ID:
00034093
Vues:
35
Rahul,

There is a caveat that Edward failed to mention. You must know exactly what the title bar is (or the class name) is. If the match isn't exact then FindWindow will fail to return the window handle. For example, right now, the title bar on my browser reads:

Universal Thread - Microsoft Internet Explorer

If I pass FindWindow "Microsoft Internet Explorer", it will return 0, even though the application is (obviously) running.

Since most prepackaged software has dynamic title bars, and the class name is not readily retrievable (and can change from version to version), FindWindow can fail in a number of cases. I have written a function that solves these problems (there are versions for both Win 3.1 and 95). I'll be happy to post it the FAQ section if there's enough response, or email me at:

GTasker@compuserve.com

Good Luck,

George


>>>I think there was a thread on this subject a few days ago. I missed that. Can somebody kindly repost the solution? I am looking for a way to determine, from within VFP, if another Windows application is running or not. If the app is not running, then I want to start it up.
>>>
>>>Thanks a lot
>>
>>Probably, I missed that thread too. But you could use FindWindow Api call:
>>DECLARE INTEGER FindWindow IN win32api INTEGER,STRING
>>if FindWindow(0,cApptitle)>0
>> =messagebox("app running")
>>else
>> RUN app.exe
>>endif
>>CLEAR DLLS
>
>
>Thanks,
>
>I'll give this a try.
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