?
Solved

Availability of the printer port?

Posted on 2000-02-15
6
Medium Priority
?
241 Views
Last Modified: 2013-11-15
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?
0
Comment
Question by:vchellam
[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
  • 4
  • 2
6 Comments
 
LVL 22

Accepted Solution

by:
nietod earned 600 total points
ID: 2523601
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
 

Author Comment

by:vchellam
ID: 2523818
Adjusted points to 150
0
 

Author Comment

by:vchellam
ID: 2523819
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
Get proactive database performance tuning online

At Percona’s web store you can order full Percona Database Performance Audit in minutes. Find out the health of your database, and how to improve it. Pay online with a credit card. Improve your database performance now!

 
LVL 22

Expert Comment

by:nietod
ID: 2524157
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
 

Author Comment

by:vchellam
ID: 2528488
Adjusted points to 200
0
 

Author Comment

by:vchellam
ID: 2528489
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

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Let’s list some of the technologies that enable smooth teleworking. 
All of the resources available today make learning a new digital media easier than ever-- if you know where to begin. This is a clear, simple guide to a few of the basic digital art mediums and how to begin learning them on your own.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…
Suggested Courses

770 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