Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
API_AppRun vs. launch an app and wait
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00680456
Message ID:
00681292
Vues:
173
Hi Neil,
>I am enjoying is_run32. Thank you for this little gem. I noticed that it returns the handle to the window that I am examining. Your documentation advises that the handle could be used for other API stuff. I got to thinking after reading that. Since I am controlling a cad cam program via SendKey commands, there is a possibility that my SendKey that causes an exit from the cad cam app, could fail because of a long file loading etc. I use is_run32 in a loop to determine if the cad cam app closes. But I also included a little counter in the loop so if the loop is transversed more that 50 times I have to assume that my sendkey never closed the app. Could I use the handle returned by is_run32 in an API thing or wsh construct to close the app. A little code would be appreciated.

Check the FAQ I wrote (FAQ#7773). It'll show you how to use the SendMessage() API call, to shutdown another application.

>I have another question about API etiqueette and housekeeping. Over the years you have posted code to UT which utilizes declare dll stuff. I have yours and other developer's code in a classlibrary called outsiders.prg
>What happens when your code and several other developer's code make the same declare statement. Are there any toes being stepped on when 2 or more functions make the same declare statement? Should I just move everybodies declare statements to the top and remove duplicates? Should I have a clear dll statement in some cleanup routine?

It's difficult to give a definitive answer to this. Frankly, "It depends...". Prior to VFP 7.0, I made it a habit to do the declarations in an object's Init event, if I was going use the object, then discard it. If, however, the object was going to be persistent, then I'd make the declarations inside the method that used it.

With VFP 7.0, however, I've changed the practice a bit. Regardless of where I make the declarations, I clear them before the method terminates with CLEAR DLLS < alias name list >.

In general, there's little harm in re-defining an API call. There are, however, specific cases where the declaration can be slightly different depending on the usage. If recollection serves, I think that this may apply to SystemParmetersInfo() as an example. To see what I mean, you might want to download my Enable/Disable Screen Saver programming and make comparisons between the declaration.
George

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

Click here to load this message in the networking platform