Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Detecting registered functions
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00227758
Message ID:
00227762
Vues:
19
There is no direct way to determine if a function was declared in a dll. One way is to try to call that function and trap the error that is generated if the function was not declared. This method works if you know the VFP name of the function (the name of dll function can be changed using the AS clause of the DECLARE command).

Another way is to DISPLAY STATUS into a file and parse the file for the dll declared functions. But this method can be slow if used intensively. And it does give the declared parameter types (the param types can be mapped differently for different purposes in VFP) or return value type. But this may not be a major problem.

Basically, reDECLARE of a function doesn't do any harm (there's no big performance penalty either). The only possible problem is when the same dll function is declared in two places with different names and/or parameters. This is why I always recommend to DECLARE the function right before its use or, at least, in the same function/procedure/method.

Another advice is to NEVER issue a CLEAR DLLS (because you never know what function declaration are you clearing).

Vlad

>I found a small program & .dll called "Addzip" that works very nicely from within VFP, but I have a problem.
>
>The first time the .dll is called, it declare various functions in the dll (via a logical parameter passed). Subsequent calls to the dll are NOT supposed to do the declares again (and generate an error).
>
>code snippet:
>
>IF Params = 0 OR lInitialize
> PRIVATE HWND
> DECLARE INTEGER GetActiveWindow IN win32api
> HWND = GetActiveWindow()
> DECLARE addZIP_Initialise IN AZIP32
> DECLARE SHORT addZIP_SetParentWindowHandle IN AZIP32 SHORT @ HWindow
> DECLARE SHORT addZIP_ArchiveName IN AZIP32 STRING @ sArchName.....
>
>
>How can you tell within VFP whether or not these declares have been done ?
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform