| |

VerySource

 Forgot password?
 Register
Search
View: 1016|Reply: 6

Help masters who are proficient in VFP and DELPHI

[Copy link]

1

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-1-28 08:40:02
| Show all posts |Read mode
Questions about using VFP to call the DLL developed by DELPHI;

The call in DELPHI is as follows:
  function GetICCardInfo (ICNo: PChar; SickerCode: Integer; SickerName: PChar): Integer; stdcall;
  far; external 'MyDelphi.dll' name 'GetICCardInfo';

How do I call it in VFP? Thank you.
Reply

Use magic Report

0

Threads

32

Posts

23.00

Credits

Newbie

Rank: 1

Credits
23.00

 China

Post time: 2020-3-1 13:45:01
| Show all posts
There are two kinds of DLL files. One is to use Declare to explain and call. This kind of file can be used after copying, but you cannot use smart prompts. You can only use special tools to check what is inside. This Dll is generally written in C. of.
The other is COM Dll, which is called with Createobject (object name).
Reply

Use magic Report

1

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 Japan

 Author| Post time: 2020-3-5 07:15:01
| Show all posts
Thank you upstairs, can you say more in detail, at present it is the DLL developed by our DELPHI. When doing interface with other developers, he will not call our DLL. I am not familiar with VFP. Can you give a detailed answer to the above example? Thank you.
Reply

Use magic Report

0

Threads

18

Posts

17.00

Credits

Newbie

Rank: 1

Credits
17.00

 Singapore

Post time: 2020-3-14 10:30:01
| Show all posts
function GetICCardInfo (ICNo: PChar; SickerCode: Integer; SickerName: PChar): Integer; stdcall;

// According to your definition of Delphi, make the following call in VFP.

Declare Integer GetICCardInfo In MyDelphi.dll String @, integer, String @

// The PChar type is both a pointer type. In VFP, the address pointer is passed through @. The above Dll passes three parameters. Return
// Integer. Calling Dll in Vfp is no different from calling Winapi.
Reply

Use magic Report

0

Threads

18

Posts

17.00

Credits

Newbie

Rank: 1

Credits
17.00

 Singapore

Post time: 2020-3-20 19:30:01
| Show all posts
After the above statement is completed, it can be called as follows:

  local lcICNo As String, lcSickerName As String
  Local lnSickerCode As Integer, lnResult As Integer

  Store Space (255) To lcICNo, lcSickerName&&&
 
  lnSickerCode = 125452
  lnResult = GetICCardInfo (@ lcICNo, lnSickerCode, @ lcSickerName)

  If lnResult> 0
     &&OK
  Else
     &&Error
  EndIf

  ///////////////////////////////////////////////////////// ///////////////////////
  In Delphi, this function accepts parameters, populates them and returns them to the caller
Reply

Use magic Report

0

Threads

18

Posts

17.00

Credits

Newbie

Rank: 1

Credits
17.00

 Singapore

Post time: 2020-3-21 00:30:01
| Show all posts
supplement:

The Function in this Dll must return an integer, and the above judgment of the returned value is determined based on the return value in Delphi.
Reply

Use magic Report

1

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

 Author| Post time: 2020-4-3 16:00:01
| Show all posts
Thank you for your enthusiastic help. Since I do not have a VFP environment here, there is no way to debug.
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list