Solved

call to dll from asp

Posted on 2010-11-23
9
350 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
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 
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

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Convert VB6 MSXML2.ServerXMLHTTP process to C# 2 47
Visual Studio search word table and return Cell index 8 61
How to Add / Edit Windows Menu 4 61
VB6 ListBox Question 4 44
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…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…

810 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