Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

call to dll from asp

Posted on 2010-11-23
9
Medium Priority
?
362 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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
 

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 2000 total points
ID: 34213048
then you may want to change to variant
0
 

Author Closing Comment

by:yairab
ID: 34213249
thanks
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

963 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