Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How To Declare DLL files

Status
Not open for further replies.

bebbo

Programmer
Dec 5, 2000
621
GB
The code below is VB code declaring a dll file.

Private Declare Function IxCF Lib "CrystalFontz.dll" (ByVal pFunc As Long)

Private Declare Function TxCF Lib "CrystalFontz.dll" (ByVal strBuffer As String, ByVal lngSize As Long) As Long

Do I declare this in Foxpro as below:

DECLARE LONG lxCF IN CrystalFontz.DLL LONG @,
DECLARE LONG TxCF IN CrystalFontz.DLL STRING @, LONG @

If not how do I do it. Thanks
 
Close, try this:

DECLARE LONG lxCF IN CrystalFontz.dll LONG
DECLARE LONG TxCF IN CrystalFontz.dll STRING, LONG

...if that doesn't work then try:

DECLARE INTEGER lxCF IN CrystalFontz.dll INTEGER
DECLARE INTEGER TxCF IN CrystalFontz.dll STRING, INTEGER


...you'll notice that I removed the "@" from your declarations, this is because according to the VB declarations the paramters are sent in ByVal. You would use the "@" symbol if the parameters were ByRef.

Slighthaze = NULL
craig1442@mchsi.com
"Whom computers would destroy, they must first drive mad." - Anon​
 
Thanks

In VB you can set Function Pointers to DLL Procedures and Type Libraries. Can you do this in VF?

VB example below

IngRet = TxCF(AddressOf CF_Callback)

Once again thanks.

 
bebbo,

VFP has nothing that is equivalent to the AddressOf in VB. Callbacks in the sense in which you are referring to them are for all purposes non-existant in VFP.

Slighthaze = NULL
craig1442@mchsi.com
"Whom computers would destroy, they must first drive mad." - Anon​
 
If there is no equivalent of AddressOf how can I get information back from a Dll file.

I know I can do the following

result = open(par1,par2)

Therefore I get a setting set to result.

How do I then let the dll file send me other information. e.g 50p entered, another 50p entered, £1 entered etc...



 
bebbo,

If there is no equivalent of AddressOf how can I get information back from a Dll file

The only way is to create your own wrapper. If you want to try, here is one "VFP Callback wrapper". I don't know if it is working perfectly because I never use it myself.

Search for ID: 20453


-- AirCon --
 
One more thing, that wrapper also contains the source code ( C# )

Regards

-- AirCon --
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top