Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

ASP calling VB Dll

Posted on 2003-03-13
6
Medium Priority
?
186 Views
Last Modified: 2010-05-01
I have a VB DLL that I call from my ASP page.  The DLL is really just a shell around another Dll.  I just created my own functions that puts a little business logic in the DLL instead of doing it in the ASP page.

My problem is this:

I can call my dll from a quick vb app I wrote to test it and it works fine.  When I try to call it from Asp page I get some wierd results.

Here is the basis of my Dll that I am calling

Private Declare Function GetDevice _
   Lib "MYDLL.Dll" (byVal ID as Integer) as Long

Public Function C_GetDevice(ByVal GetId as Integer) as Long
    C_GetDevice = GetDevice(GetId)
End Function

From VB I do this:

Dim oDll as Object
Set oDll = CreateObject("CDUSB.MyDll")

rtn = oDll.C_GetDevice(0)

I receive 18481 back

From ASP I do this:
Dim oDLL
Set oDll = server.createobject("CDUSB.MyDll")

rtn = oDll.C_GetDevice(0)

I receive back -437385700

0
Comment
Question by:edfrazier
6 Comments
 

Assisted Solution

by:Skirde
Skirde earned 150 total points
ID: 8131384
It's been a while since I did this but if I remember right ASP pages don't understand datatypes other than variant so it may be a type mismatch.

good luck
0
 
LVL 10

Assisted Solution

by:aeklund
aeklund earned 150 total points
ID: 8131639
I think the problem lies with your function "GetDevice" inside mydll.dll.

I recreated your three files, mydll.dll and cdusb.dll and an asp page...  I cannot see what your function does, so I simulated it and have it just return a static number "18481" and I get the same results when I call it from vb, or asp.
0
 
LVL 44

Accepted Solution

by:
Arthur_Wood earned 150 total points
ID: 8133103
what your GetDevice is returning is called a Device HANDLE, and that is essentially a memory location, which may be 1) different each time the code is executed, and especially if run on differwent machines, or platforms (VB IDE vs WebServer), and 2) is a Long integer, which may or may not have the High bit set (which is the bit which controls + or -)

The fact that the two calls are returning different values is not so important as whether they ALWAYS RETURN the SAME value (one value when running from the VB IDE- but the SAME value each time it runs in this mode) and a Different value(perhaps, buy again the SAME value) when ruuning on the WebServer, from the ASP page.

AW
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 26

Assisted Solution

by:EDDYKT
EDDYKT earned 150 total points
ID: 8135903
May be change all interger to long


ie

Private Declare Function GetDevice _
  Lib "MYDLL.Dll" (byVal ID as long) as Long


etc

0
 

Expert Comment

by:CleanupPing
ID: 9056360
edfrazier:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0
 

Author Comment

by:edfrazier
ID: 9404699
This was never resolved, thanks for the help
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

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…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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

580 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