English 中文(简体)
best solution to use a DLL/Driver?
原标题:

Im working with a CD722UN Customer Display for our POS application.

it comes with a USB2.0 connection and a installation package containing a driver ect..

now, for my application. how should i do when i want to access this driver?

at the moment i m using the "CD722UN application"s .dll path but that can warry from clients OS ect..

    Declare Function opencd722usb Lib "C:Programcd7220 USBcd722dusb.dll" () As Boolean
    Declare Function writecd722usb Lib "C:Programcd7220 USBcd722dusb.dll" (ByRef dataoutput As Byte, ByVal Length As Integer) As Integer
    Declare Function readcd722usb Lib "C:Programcd7220 USBcd722dusb.dll" (ByRef DataInput As Byte, ByVal size As Integer) As Integer
    Declare Function closecd722usb Lib "C:Programcd7220 USBcd722dusb.dll" () As Boolean

my first thought was to first check if there was a device installed in the device manager and somehow use the driver from there???
or
distribute the .dll inside our application folder and use
searchpath ""installed directory"cd722dusb.dll"

what is the best solution?

thanks in advance!

最佳回答

Figuring out how to access the device yourself is not typically a good idea when you have zero documentation on how to do so properly. There are too many possibilities and the code can be quite awkward in a managed language. You probably can t even get any documentation if the supplier already provides an access DLL.

The odds are pretty good that this DLL will work if you simply copy the DLL into the same folder as your EXE. Try that first, only the DLL name is required in the Declare statement. Look in the install directory for other DLLs that might need to be copied as well if you have trouble. The next option is to P/Invoke the SetDllDirectory() function if you can discover the path at runtime. The next option is to have the installer add the directory that contains the DLL to the system PATH environment variable. Hard-coding the path is your last resort.

问题回答

暂无回答




相关问题
Is Shared ReadOnly lazyloaded?

I was wondering when I write Shared ReadOnly Variable As DataType = New DataType() Or alternatively Shared ReadOnly Variable As New DataType() Is it lazy loaded or as the instance initializes? ...

Entertaining a baby with VB.NET

I would like to write a little application in VB.NET that will detect a baby s cry. How would I get started with such an application?

Choose Enter Rather than Pressing Ok button

I have many fields in the page and the last field is a dropdown with list of values. When I select an item in a dropdown and press Enter, it doesn t do the "Ok". Instead I have to manually click on Ok ...

ALT Key Shortcuts Hidden

I am using VS2008 and creating forms. By default, the underscore of the character in a textbox when using an ampersand is not shown when I run the application. ex. "&Goto Here" is not ...

Set Select command in code

On button Click I want to Set the Select command of a Gridview. I do this and then databind the grid but it doesn t work. What am i doing wrong? protected void bttnView_Click(object sender, ...

Hover tooltip on specific words in rich text box?

I m trying to create something like a tooltip suddenly hoovering over the mouse pointer when specific words in the richt text box is hovered over. How can this be done?

热门标签