| |

VerySource

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

vb calling vc's Dll problem, "Bad DLL calling convention" Run-time erroe '49' appears

[Copy link]

1

Threads

4

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-1-7 13:50:02
| Show all posts |Read mode
Functions exported using MFC DLL in VC:
void __stdcall PrintPortOut (BYTE data)
{
theApp._outp (0x378, data);
}
And there is output in .def: EXPORTS
    ; Explicit exports can go here
PrintPortOut

Then call in VB:
Declare Function q Lib "PrintPort.dll" Alias ​​"PrintPortOut" _
    (ByVal pSelectAdapter As Byte)

Private Sub Command1_Click ()
Dim c As String
Dim d As Byte
d = CByte (&H0)
c = q (d)
End Sub
But the execution will always error: "Bad DLL calling convention" Run-time erroe '49'?
Reply

Use magic Report

1

Threads

4

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

 Author| Post time: 2020-1-9 13:27:01
| Show all posts
Everyone gives suggestions.
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-1-9 16:45:01
| Show all posts
See if the array is out of bounds
Reply

Use magic Report

1

Threads

4

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

 Author| Post time: 2020-1-10 10:54:02
| Show all posts
Thank you, there should be no problem with arrays out of bounds?
Reply

Use magic Report

0

Threads

55

Posts

32.00

Credits

Newbie

Rank: 1

Credits
32.00

 China

Post time: 2020-1-10 20:45:01
| Show all posts
DLL should be regular DLL
Reply

Use magic Report

1

Threads

4

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

 Author| Post time: 2020-1-24 16:36:01
| Show all posts
Thank you, it has been resolved, it is a VB problem.
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 Hong Kong

Post time: 2020-9-6 01:45:01
| Show all posts
Excuse me, what is the problem, I also encountered this problem. . . .
How to solve it. .
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