Solved

Availability of the printer port?

Posted on 2000-02-15
6
228 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
  • 4
  • 2
6 Comments
 
LVL 22

Accepted Solution

by:
nietod earned 200 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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

I annotated my article on ransomware somewhat extensively, but I keep adding new references and wanted to put a link to the reference library.  Despite all the reference tools I have on hand, it was not easy to find a way to do this easily. I finall…
I previously wrote an article addressing the use of UBCD4WIN and SARDU. All are great, but I have always been an advocate of SARDU. Recently it was suggested that I go back and take a look at Easy2Boot in comparison.
This video demonstrates how to use each tool, their shortcuts, where and when to use them, and how to use the keyboard to improve workflow.
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…

746 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now