Solved

About LPT port capture

Posted on 1998-01-02
8
495 Views
Last Modified: 2008-02-01
Hello
I need see the printers in an PC and capture a port for connect to this printers. Under Win95 and Windows NT.
In other words:
How to capture an LPT port and how to see what printers have shared another computer?
Thanks and regards
0
Comment
Question by:amanuelx
  • 6
  • 2
8 Comments
 
LVL 8

Accepted Solution

by:
mrmick earned 300 total points
ID: 1448789
You can enumerate through the connected printers with this:

Dim P as printer
For each P in printers
   debug.print p.name
Next

0
 
LVL 8

Expert Comment

by:mrmick
ID: 1448790
Whoops, that's

Dim P as Printer

For Each P in Printers
  Debug.Print P.DeviceName, P.DriverName, P.Port
Next
0
 
LVL 8

Expert Comment

by:mrmick
ID: 1448791
What do you mean by "capture an LPT Port"?

To enumerate the printers available on the network that are shared but NOT connected.  You can use the API function:

WNetEnumResource


0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:amanuelx
ID: 1448792
Well, i can see the printers availables if i before select it.
I need too see the other pc's and see if they have any printer shared.
i need then assign my lpt1 port to any of these printers, and then (once used) deassign this lpt1 port.
Tx
0
 
LVL 8

Expert Comment

by:mrmick
ID: 1448793
This is a little more complicated, If you'd like, I'll write you an example of enumerating all available shared network printers on the network, and an example of how to connect to and disconnect from a network resource.

If this is acceptable, provide your email address so I can send you the sample project.  Also, you must agree to give me credit for the answer to this question once I've provided the examples.
0
 

Author Comment

by:amanuelx
ID: 1448794
Ok, if i can assign my lpt1 to any printer of these, OK !
Regards
0
 
LVL 8

Expert Comment

by:mrmick
ID: 1448795
It's a deal, What's your email address?
0
 
LVL 8

Expert Comment

by:mrmick
ID: 1448796
If you prefer, you can email it to me at mick@owen.wa.com
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying 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

Suggested Solutions

Title # Comments Views Activity
VBA Word macro - how to get characters after the searched for string 5 93
VBA Shell can't Find Word document 11 108
VB6 - Convert HH:MM into Decimal 8 62
Problem to With line 4 63
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

765 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