ASP calling VB Dll

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

edfrazierAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

SkirdeCommented:
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
aeklundCommented:
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
Arthur_WoodCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

EDDYKTCommented:
May be change all interger to long


ie

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


etc

0
CleanupPingCommented:
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
edfrazierAuthor Commented:
This was never resolved, thanks for the help
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.