Solved

Port Address Detection - URGENT

Posted on 2006-10-27
7
170 Views
Last Modified: 2010-04-05
I am using INPOUT32.DLL to send data to a printer (serial, parallel or usb) and therefore require the port address to send the data to.

I am detecting the port name using GetPrinter(Device, DriverName, Port, DevHandle);

However this simply gives me the name of the port in the format "COM1:", "LPT1:", etc

I need the actual memory address ie "$378", etc to send to the INPOUT32.DLL

This is for an urgent project so i am assigning max points for it! help!
0
Comment
Question by:loonyroony
  • 3
  • 3
7 Comments
 
LVL 19

Accepted Solution

by:
MerijnB earned 500 total points
ID: 17818581
normally I use http://www.mitec.cz/msi.htm for these things, but the author doesn't sell at this moment.
I have a license and it permits me to write you a dll (no sources) to do this. I've looked if it's possible and it seems it is.
The only strange thing when I look for the address of for example LTP1 is that it returns _two_ addresses: $378 and $778.
Device manager in windows XP does the same. If you think you can use this and know a what to distinguish these two addresses I'll make the DLL for you.
0
 

Author Comment

by:loonyroony
ID: 17818767
hey man

that sounds great to me :-) i'm sure with a little trial and error i should be able to work out which port is the right one - in the case of LPT1 it's usually 378 so i'd assume that if order of returned ports numbers is always the same then the correct one should always be in the same position. Dangerous things assumptions are but i don't think this one will cast the end of the world spell! :-)
0
 
LVL 19

Expert Comment

by:MerijnB
ID: 17818913
ok, in for my machine for lpt1 I get:
$0378-$037F
and
$0778-$077B

if anyone knows a brilliant way to determine which is which please let me know :)
I'll make the DLL, for now I think I'll only pass the first range which is 7 long, because that seems to be the case almost always.
0
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 

Author Comment

by:loonyroony
ID: 17818949
cool man thanks :-)
0
 
LVL 19

Expert Comment

by:MerijnB
ID: 17819254
do you have some place I can upload or send the dll to?
0
 

Author Comment

by:loonyroony
ID: 17819293
sure - email me on haroun@mcomputer.com
0
 
LVL 17

Expert Comment

by:Wim ten Brink
ID: 17832401
Guys, in Windows XP the port addresses are protected resources. Doing direct reads and writes to an address is risky at least since you never know what it connects to.

The reason for two ports is easy, btw. One port is used to send command and receive responses. The second port is used to send and receive related data for these commands and responses.

Also, take a look at the following links:
http://www.logix4u.net/inpout32.htm
http://www.logix4u.net/inpout_theory.htm
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

785 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question