?
Solved

ASP calling VB Dll

Posted on 2003-03-13
6
Medium Priority
?
175 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
[X]
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
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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 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…
Suggested Courses

752 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