Solved

call to dll from asp

Posted on 2010-11-23
9
347 Views
Last Modified: 2012-05-10
hi

i have dll in dll i have 2 function 1 is a test function the work o.k.
i have a problem whit 2nd function:

this how i call to dll functions



Set AddNum=Server.CreateObject("pltTester.pltParser")
            
            Result=AddNum.pltProsess(5, 6)
            response.write(Result)
            response.Write("<br>")
            dim z
            z = "E:\PLTTest\1.plt"
            Result=AddNum.func2(z, x, y)

******************************************************************
this is the dll cod :

Dim x
Dim y
Dim fileName
Private Declare Function GetDimensions Lib "E:\PLTTest\PLTAnalyzerCom.dll" _
    (ByVal fileName As String, ByRef x As Long, ByRef y As Long) As Long

Public Function pltProsess(ByRef x As Long, ByRef y As Long) As Integer
    pltProsess = x + y
End Function


Public Function func2(ByVal fileName As String, ByRef x As Long, ByRef y As Long)
 
   
    Dim result
    result = GetDimensions(fileName, x, y)
 
   func2 = x + y
End Function

watt i get is

11 (from first function )

and from 2nd function

vbScript runtime error 800A000d
type mismatch: "func2"

func 2 in dll call to c++ dll that get filename and return return x , y


0
Comment
Question by:yairab
  • 4
  • 4
9 Comments
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 34198663
Where are "x" and "y" coming from in your ASP code?
0
 
LVL 26

Expert Comment

by:EDDYKT
ID: 34199404
you need to print out the result

ie

Result=AddNum.pltProsess(5, 6)
            response.write(Result)
            response.Write("<br>")
            dim z
            z = "E:\PLTTest\1.plt"
            Result=AddNum.func2(z, x, y)
response.write(Result)
            response.Write("<br>")


0
 

Author Comment

by:yairab
ID: 34203133
hi
my x,y are  defined in the function they are for the x,y that return from dll


EDDKT - i print all  the result if the  function in the dll getting beRef x as long and beRef y as long i get the error msg  vbScript runtime error 800A000d
type mismatch: "func2"

thanks
0
 
LVL 26

Expert Comment

by:EDDYKT
ID: 34204610
Try to redefine thi

Public Function func2(ByVal fileName As String, ByRef x As Long, ByRef y As Long)
to

Public Function func2(ByVal fileName As String, ByRef x As Vaiant, ByRef y As Variant)
 Dim result
dim x1 as long
dim y1 as long
x1 = clng(x)
y1 = clng(y)

    result = GetDimensions(fileName, x1, y1)
x
The reason when you call from asp, if you want to return x,y you need to return as variant

or

Public Function func2(ByVal fileName As String, ByVal x As Long, ByVal y As Long)

0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:yairab
ID: 34204977
hi
eddykt

yes i know that if do Public Function func2(ByVal fileName As String, ByVal x As Long, ByVal y As Long) i dont have asp error but for the c++ dll that cll from vb dll i must have beRef
0
 
LVL 26

Expert Comment

by:EDDYKT
ID: 34206859
if you don't return value for x and y, why not just use byval?
0
 

Author Comment

by:yairab
ID: 34212871
sorry

i do return

i need to use x and y from vb dll
0
 
LVL 26

Accepted Solution

by:
EDDYKT earned 500 total points
ID: 34213048
then you may want to change to variant
0
 

Author Closing Comment

by:yairab
ID: 34213249
thanks
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
using Access 8 58
Need to rewrite code for checking if a file exists 3 57
ASP Focus problem 3 52
wordpress display sub menu only when click 12 21
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

912 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now