Availability of the printer port?

Hello guys,

In my GUI, i have list of ports which i need to select one to configure my printer! but i want to find if the selected port is already been used by some other printer or device? from visual c++ code how do i do that? any idea?
vchellamAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
nietodConnect With a Mentor Commented:
usually in windows you would have the OS deal with determining which printer port to use and how to configure it.   But if you want to do it yourself, simply try to open port as a file using CreateFile().  I the port is already open, the CreateFile() will fail.

Let me know if you have any questions.
0
 
vchellamAuthor Commented:
Adjusted points to 150
0
 
vchellamAuthor Commented:
what i want to do is first to find out if its been used by any printer if so i have to put  message the its been used by the corresponding printer, if not used by printer, its used by some other device, i was put the message that the device is using! so i need the printer name using that port
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
nietodCommented:
I think the EnumPorts() function should do what you want.  It will enumerate all the ports that are beign used by the printer server.
0
 
vchellamAuthor Commented:
Adjusted points to 200
0
 
vchellamAuthor Commented:
Thanks guys, i used enumprinters which tells the ports used by the current printers and i also used createfile functions

thanks guys for helping me out!
Venky
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.