| |

VerySource

 Forgot password?
 Register
Search
View: 800|Reply: 4

How to pass the string in the dll written by vc to vb?

[Copy link]

2

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-10-14 09:30:01
| Show all posts |Read mode
It doesn’t work for a long time, please help! Write a small example for me
Reply

Use magic Report

0

Threads

8

Posts

9.00

Credits

Newbie

Rank: 1

Credits
9.00

 China

Post time: 2020-10-14 09:45:01
| Show all posts
__stdcall int CALLBACK CalcSum(int a,int b,char *c);

You can declare in vb:
Private Declare Function MySum Lib "d:\MyDLL.dll" (ByVal S As Integer, ByVal D As Integer, ByRef c as string) As Integer
Reply

Use magic Report

0

Threads

4

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-10-14 16:15:01
| Show all posts
In VC, the BSTR type corresponds to the STRING type in VB.
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-10-14 19:00:01
| Show all posts
Note that the string type in VC uses wide characters, otherwise it will not match. Because VB uses unicode encoding. Also, the rows and columns of the two-dimensional arrays of VB and VC are just reversed. It is best not to write DLLs in the two-dimensional array format.
Reply

Use magic Report

0

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-10-14 19:15:01
| Show all posts
Just use stdcall, other methods are the same as calling ordinary api
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