-
Jan 9th, 2009, 04:36 AM
#1
Thread Starter
Addicted Member
[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.
-
Jan 9th, 2009, 06:30 AM
#2
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?
-
Jan 9th, 2009, 06:56 AM
#3
Thread Starter
Addicted Member
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
-
Jan 9th, 2009, 09:02 AM
#4
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?
-
Jan 9th, 2009, 09:14 AM
#5
Thread Starter
Addicted Member
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?!
-
Jan 9th, 2009, 09:23 AM
#6
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?
-
Jan 9th, 2009, 09:38 AM
#7
Thread Starter
Addicted Member
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
-
Jan 9th, 2009, 09:42 AM
#8
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
-
Jan 9th, 2009, 09:56 AM
#9
Thread Starter
Addicted Member
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 ???
-
Jan 9th, 2009, 11:13 AM
#10
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).
-
May 4th, 2012, 04:29 PM
#11
New Member
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!
Originally Posted by waelr
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
-
Feb 27th, 2017, 04:59 PM
#12
New Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|