Link to home
Start Free TrialLog in
Avatar of mece
mece

asked on

Find the number of serial and parallel ports on computer

How can i find the number of serial and parallel ports on any computer (98 or NT)
Avatar of andrewjb
andrewjb
Flag of United Kingdom of Great Britain and Northern Ireland image

I've never found a decent way by looking in the registry or anything like that. Some things work on NT, some on 95/98, but not on both.

To find serial ports, I simply try to Open every 'file' named "COM1" , "COM2", .... up to, sayt "COM99"
It either works, fails with an error code that means 'not there' or fails with an error code that means 'exists, but open by someone else'.

That's the only way I've come up with so far.
As a comment, this took me quite a while to figure out, so it might be worth PAQ-ing as a possible solution. I haven't found or come up with anything better since.
(You could even give me the points :-)  )
Avatar of mece
mece

ASKER

but that is not the answer
i found the answr at the internet
the answer is look to the registry
HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\PARALLEL PORTS
HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\SERIALCOMM


OK - if you think that's the answer, it would be useful to expand a little so this question can be PAQ-d for future reference.

I'm not convinced, though. Have you tried tihs on Win95/98, NT, XP and 2000? I'm pretty sure I took that path, too, and it doesn't work on all platforms.
ASKER CERTIFIED SOLUTION
Avatar of Lunchy
Lunchy
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mece

ASKER

i tried at 98 and above,
i dont tried at windows 95,