Results 1 to 12 of 12

Thread: [2008] Reference a DLL

  1. #1

    Thread Starter
    Addicted Member waelr's Avatar
    Join Date
    Nov 2004
    Posts
    168

    [2008] Reference a DLL

    Hello
    Am not an ASP.NET developer.. but I need to accomplish this specific task
    I developed a windows application that reads data from a cheque scanner through a DLL
    In my windows application I used the following declaration without adding a reference from the "Add Reference" wizard

    Code:
    Declare Function TS2OpenConnection Lib "TS2Dll.dll" (ByVal Mode As Integer, ByVal MsgToUse As Integer, ByVal ParentThreadID As Integer) As Integer
    Declare Function TS2EnableScan Lib "TS2Dll.dll" (ByVal DeviceID As Integer) As Boolean
    and on my form load event am using the following:

    Code:
    Dim dev_id As Long
    dev_id = TS2OpenConnection(0, 0, 0)
    TS2EnableScan(dev_id)
    now the scanner is ready and I can pass the cheques and with some more functions I can get the front and back image and read the MICR line

    Trying to do the same with ASP.NET is not working.. as if the scanner doesn't even exist!! Seems like there is a different approach maybe ?!

    Help appreciated.. thank you
    Last edited by waelr; Jan 9th, 2009 at 04:41 AM.

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,173

    Re: [2008] Reference a DLL

    It's not entirely clear what the problem is.

    You should be able to add the WIN32 references as you have done in your code above, but keep in mind that the device will need to be on the web server, not the client machine.

    Other than that, have you tried debugging it? Stepping through the code to see if any exceptions are being swallowed somewhere?

  3. #3

    Thread Starter
    Addicted Member waelr's Avatar
    Join Date
    Nov 2004
    Posts
    168

    Re: [2008] Reference a DLL

    At this point there is no client machine and web server.. there is only my development PC. Am using Visual Web Developer Express 2008 and its built in web server

  4. #4
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,173

    Re: [2008] Reference a DLL

    Other than that, have you tried debugging it? Stepping through the code to see if any exceptions are being swallowed somewhere?

  5. #5

    Thread Starter
    Addicted Member waelr's Avatar
    Join Date
    Nov 2004
    Posts
    168

    Re: [2008] Reference a DLL

    I've tried but no exceptions are being raised..
    I placed my DLL in C:\DLL\ and changed my declaration to

    Code:
    Declare Function TS2OpenConnection Lib "C:\DLL\TS2Dll.dll" (ByVal Mode As Integer, ByVal MsgToUse As Integer, ByVal ParentThreadID As Integer) As Integer
    Declare Function TS2EnableScan Lib "C:\DLL\TS2Dll.dll" (ByVal DeviceID As Integer) As Boolean
    nothing changed.. i removed TS2Dll.dll from this directory and I got the following exception:
    "Unable to load DLL 'C:\DLL\TS2Dll.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)"

    So I guess I dont have a problem with the DLL or the permissions.. but rather with declaring the functions maybe?!

  6. #6
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,173

    Re: [2008] Reference a DLL

    The code you use for the windows form will be the same as you use it here for the most part.

    From what I see, you are setting references to the DLLs. That's fine.
    You're opening a connection and enabling scan. That's fine.

    Now, if your device is supposed to raise an event of some sort because the connection is open and scan is enabled, but your page has finished executing, then nothing will happen. This is because of the fact that execution has stopped.

    Is that what you're expecting to happen or is the problem that the connection-open doesn't work or that the enable-scan doesn't work?

  7. #7

    Thread Starter
    Addicted Member waelr's Avatar
    Join Date
    Nov 2004
    Posts
    168

    Re: [2008] Reference a DLL

    My guess is the connection is not opening
    Code:
    dev_id = TS2OpenConnection(0, 0, 0)
    dev_id remains 0, while it should get a large value

  8. #8
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,531

    Re: [2008] Reference a DLL

    It's not you that has the problem.... it's the account that the IIS (as well as the builtin web "server" for WebDevExpress) is running under. For security reasons, when installing IIS, a special user account is created with limited access, for IIS to run under. It's to help prevent someone from uploading something to the server and gaining control. The C Root is one of those off limit areas. If I remember right, the only fodler it should have access to is the web root folder. Now here's the dirty truth about development (snags a lot of people in winforms development too) ... put the DLLs back in the fodler with the webpages.... then in the solution explorer, right click the DLLs and check their properties. Make sure they are set to copy to the destination folder - what's probabnly happening is that when you go to run it, the web pages are being moved to the web server and run, but the DLLs aren't. This will prevent them from being found when the pages run.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  9. #9

    Thread Starter
    Addicted Member waelr's Avatar
    Join Date
    Nov 2004
    Posts
    168

    Re: [2008] Reference a DLL

    Thanks 4 the info.. now I remember why I gave up on web development a couple of years ago
    I did all that but still no result... I guess the InteropServices services part is still missing... I added "Imports System.Runtime.InteropServices" in my VB code but do I need it add in the HTML source too ???

  10. #10
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,173

    Re: [2008] Reference a DLL

    To follow up on tg's post, try using windows authentication.

    In IIS, set your virtual directory to use Windows Authentication. In your web.config, add <identity impersonate="true" />. Then restart your application and it should be running under the security of the logged in user (you).

  11. #11
    New Member
    Join Date
    May 2012
    Posts
    1

    Re: [2008] Reference a DLL

    Hi waelr, I know this is and old post.. but I'll appreciate if you have a complete list of the functions on this DLL..

    Thanks in advance!

    Quote Originally Posted by waelr View Post
    Hello
    Am not an ASP.NET developer.. but I need to accomplish this specific task
    I developed a windows application that reads data from a cheque scanner through a DLL
    In my windows application I used the following declaration without adding a reference from the "Add Reference" wizard

    Code:
    Declare Function TS2OpenConnection Lib "TS2Dll.dll" (ByVal Mode As Integer, ByVal MsgToUse As Integer, ByVal ParentThreadID As Integer) As Integer
    Declare Function TS2EnableScan Lib "TS2Dll.dll" (ByVal DeviceID As Integer) As Boolean
    and on my form load event am using the following:

    Code:
    Dim dev_id As Long
    dev_id = TS2OpenConnection(0, 0, 0)
    TS2EnableScan(dev_id)
    now the scanner is ready and I can pass the cheques and with some more functions I can get the front and back image and read the MICR line

    Trying to do the same with ASP.NET is not working.. as if the scanner doesn't even exist!! Seems like there is a different approach maybe ?!

    Help appreciated.. thank you

  12. #12
    New Member
    Join Date
    Feb 2017
    Posts
    1

    Re: [2008] Reference a DLL

    Hi Waelr, I also know that this is an old post.

    I'm writing an App to get the Image (front and Back) from a check and also get the MICR line.

    Would you mind sharing a sample of your code for that ???

    I cannot seem to find any reference for that library.

    Thanks in advance !!!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width