Calling a C++ dll from VB 
Author Message
 Calling a C++ dll from VB

Hi all

I know this probably isnt the appropriate place to post this type of problem
but it is a really bizarre one and i dont know where to go to.

I reciently built a dll in vc++ it had only one entry function, with 4
parameters

int APIENTRY GetComArg(char* retcode, char *filepath, char *signature, char
*license )

I tested it with a simple main written in c++ and everything works fine.

Im now trying to run this dll from VBScript and a strange thing happens.

my vb code looks thike this
This is all behind a button

Private Sub Command1_Click()
Dim sLocation As String
Dim sSigID As String
Dim sRegText As String
Dim eCode As String

sLocation = "a:\myprog.exe"
sSigID = "%1 %2 %3 %4"
sRegText = "Signature Test"
eCode = "MM"

Call WriteNTSig(eCode, sLocation, sSigID, sRegText)
End Sub

// in the decleration of WriteNTSig

Declare Function GetComArg Lib "C:\My
Projects\NewSigNT\Release\NewSigNT.dll" (ByVal errorcode As String, ByVal
filepath As String, ByVal signature As String, ByVal license As String)

Function WriteNTSig(eCode As String, sLocation As String, sSigID As String,
sRegText As String)
Dim iRetVal As Integer

iRetVal = GetComArg(eCode, sLocation, sSigID, sRegText)

MsgBox "Complete " & iRetVal

End Function

The problem is as this - the parameters when passed to the dll get sqewed!
retcode is null
filepath has the value of retcode "MM"
signature has the value for filepath "a:\myprog.exe"
license has the value for signature "Signature Test"
and the value for license disappears
The error Runtime Error 49 Bad Dll Calling Convention appears but im using
the right number of parameters and the right type(as far as i can see)

All help in this difficult matter will be greatly appreciated

James



Mon, 30 Dec 2002 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Calling a C++ DLL using vb

2. Instability when calling a C++ DLL from VB.NET

3. Calling a C++ DLL from VB

4. Problem Calling AXON C++ DLL in VB 4 (fwd)

5. Problem Calling AXON C++ DLL in VB 4

6. Calling Turbo C++ DLLs from VB

7. Calling a C++ DLL from VB

8. Calling A C++ DLL from VB without having Declare Statements

9. VB 5.0 calling C++ 5.0 DLL that calls winsock.dll

10. Calling a C++ DLL function which takes an C++ object as parameter

11. call C++ dll in VB.net

12. Debugging C++ DLL which is called from VB

 

 
Powered by phpBB® Forum Software