Solved

call to dll from asp

Posted on 2010-11-23
9
345 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
Comment Utility
Where are "x" and "y" coming from in your ASP code?
0
 
LVL 26

Expert Comment

by:EDDYKT
Comment Utility
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
Comment Utility
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
Comment Utility
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
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 

Author Comment

by:yairab
Comment Utility
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
Comment Utility
if you don't return value for x and y, why not just use byval?
0
 

Author Comment

by:yairab
Comment Utility
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
Comment Utility
then you may want to change to variant
0
 

Author Closing Comment

by:yairab
Comment Utility
thanks
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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.
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

762 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

10 Experts available now in Live!

Get 1:1 Help Now