Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Trying to call DLL function
Message
 
To
18/08/1997 11:30:50
Edward Crawford
City Facilities Management
Glasgow, United Kingdom
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00044984
Message ID:
00045323
Views:
47
>>>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
>>
>>This is a real shot in the dark, but here are two things to try:
>>
>>1. Drop the AS clause in the declaration and/or;
>>
>>2. Change the alias being used.
>>
>>It could be that there's a conflict being generated by the declaration.
>>
>>HTH,
>>
>>George
>
>George,
>
>Just tryed both of your sugestions, still no good. Thanks fot your though, I'll try anything.
>
>Ed

This is a stupid suggestion I know, but try adding the DLL extension in the declaration.

You mentioned that value returned indicates that there's an error. Does the documentation give you any clue as to what the error could be?

Two thoughts:

1.) And this may also be farfetched, it could be that you may still have a conflict because of the function's name. There could be an internal FoxPro function named "FPInitialize". I have no way, however, of knowing for certain. If it is the case, I don't think there's a work-around in FoxPro. Which leads me to thought two.

2. Since you seem to have a good knowledge of VB, you might consider trying to create an ActiveX control for the DLL. If you could do that, not only could you hide the complexity of dealing with it, but probably could use it rather than the direct call.

George
George

Ubi caritas et amor, deus ibi est
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform