Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Port Address Detection - URGENT

Posted on 2006-10-27
7
Medium Priority
?
182 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 2000 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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 course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses
Course of the Month10 days, 23 hours left to enroll

885 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