Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Trying to call DLL function
Message
De
15/08/1997 19:04:15
Edward Crawford
City Facilities Management
Glasgow, Royaume Uni
 
 
À
15/08/1997 18:52:37
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00044984
Message ID:
00045057
Vues:
52
>>I am trying trying to call a DLL function. The VB code that works properly is as Follows:
>>
>>//////////////////////////
>>Declare Function FPInitialize% Lib "ETFAXD32.DLL" (lpdFaxHandle&)
>>
>>Private Sub Command1_Click()
>>
>> wstatus = FPInitialize(dFaxHandle)
>>
>>End Sub
>>/////////////////////////
>>
>>In this code, the value of dFaxHandle is properly assigned a Long Integer value, and wstatus is assigned 0, indicating success.
>>
>>I'm trying to do the samething in VFP 5.0. Here is the code for VFP:
>>
>>DECLARE INTEGER FPInitialize IN ETFAXD32 AS FpInitialize ;
>> Long @nFpHandle
>>
>>nStatus = FpInitialize(@nFaxHandle)
>>
>>As near as I can tell, this should return the samething, but a Long integer gets assigned to nFaxHandle(as I would expect) and a large integer gets assigned to wStatus, indicating failure.
>>
>>This seems simple enough, what am I missing here?
>>
>>Ed
>
>You need to initialize the nFaxHandle before the call to FpInitialize. VFP doesn't initialize variables passed as params to a DLL function.
>
>So, include a
>
>nFaxHandle = 0
>
>before nStatus = ...
>
>Vlad

Sorry Vlad, I forgot to put that on this sample. I initialize nFaxHandle with 0 at the top of the program. Looking at it with the debuger I can see that it does indeed have the value of 0 prior to calling FPInitialixe(). Any other ideas?

Ed
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform