Solved

Port Address Detection - URGENT

Posted on 2006-10-27
7
175 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

 

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: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Suggested Courses
Course of the Month10 days, 3 hours left to enroll

624 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