Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

call to dll from asp

Posted on 2010-11-23
9
351 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
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

829 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