Quote:
|
Originally Posted by anant_tickoo
can i do this without the dlls grumpy
|
Short answer is it is technically possible, but not a particularly good idea.
The longer answer is that, to access the parallel port from user code, you need the help of a kernel mode driver. That kernel mode driver is normally represented by a .sys file which is installed into your system, and typically requires registration as a windows service (via the SCM : Service Control Manager). The act of installation requires administrative privileges.
While you can take all that out of DLL's (eg inpout32.dll installs a hardware driver named hwinterface.sys if necessary --- IF it is used by a program run by a user with administrator privileges). The catch is that taking the functionality out of the DLL requires you to put that functionality into every program that would otherwise use that DLL --- which is not a good idea as it is easier for a programmer to forget one or more essential steps.
The way I usually handle this is to write my program so it uses the DLL (eg via LoadLibrary() and related functions), and also to pack my program and the DLL into an installer. The installer, when run, insists on having administrator privilege and places the DLL where it needs to go and loads it once --- which installs the kernel mode driver.
Needing to distribute programs that require this sort of thing teaches one the value of installer software, such as
Inno Setup or
NSIS. With either of these programs (and presumably with other ones out there) you create a script which checks it is run by an administrator, installs your application, installs the DLL, and then does the necessary tricks to ensure the kernel mode driver is installed.