Solved

Port Address Detection - URGENT

Posted on 2006-10-27
7
171 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
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Delphi - replicating a form 8 81
Adoquery sql  left join does not work 25 99
PHP preg_replace code convert to Delphi 14 66
Microsoft Access 97 and Delphi XE2 9 54
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
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 video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

860 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