Retrieve Network prn's share name & IP/NetBios (Solved)

Retrieve Network prn's share name & IP/NetBios (Solved)

Postby anserkk » Fri Oct 31, 2008 2:06 pm

Hi all,

Is there any way to get the netbios name/IP and printer's share name of a selected printer.

My intention is to create a string as follows

"\\PrinterName\PrinterSharename"

Later I need to use this string to map LPT port..

In my prg I am doing a command Copy test.txt to \\PrinterName\PrinterSharename

I am having a wierd problem with some of the shared Dot matrix printers in my network. When I check for the selected printers port it shows as LPT1 and which is not physically connected to my PC's LPT port.

Regards

Anser
Last edited by anserkk on Mon Nov 03, 2008 10:44 am, edited 4 times in total.
User avatar
anserkk
 
Posts: 1331
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Postby driessen » Fri Oct 31, 2008 3:16 pm

Anser,

Download this file http://www.andtechnologies.com/download/dosprint.zip, which is freeware.

It is a very easy utility to capture any printer on your network to LPT1, LPT2, ...

You can install it as a system service and it works very well.

I think it is the opposite of your question but you might be able to solve your problem using DosPrint as well. In fact, I did.

Good luck.
Regards,

Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 24.02 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc77
User avatar
driessen
 
Posts: 1399
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Postby anserkk » Fri Oct 31, 2008 4:19 pm

Thankyou Michel. Shall check the software. My intention is to avoid installation & dependencies of softwares other than mine on my users PC. It will be a very large installation.

Thank you very much.

Regards

Anser
User avatar
anserkk
 
Posts: 1331
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Postby marca » Fri Oct 31, 2008 6:58 pm

Ola Anser
Seguem varias funçoes sobre este assunto
? GetDefaultPrinter(), PrnGetName(),PrnGetDrive() ,PrnGetOrientation() ,AGetPrinters()
aPrinters()

aImpr := GetPrinters(.T.)
For nX := 1 To Len(aImpr)
? aImpr[nX][1],aImpr[nX][2]
Next
Marcelo Ferro da Silveira
Fwh14.04/xHarbour 1.2.3 Simplex / Bcc582 / Pelles 8
SqlLib /xMate/WS
marca
 
Posts: 116
Joined: Mon Aug 13, 2007 5:22 pm
Location: Brazil

Postby anserkk » Sat Nov 01, 2008 5:18 am

Example1 : Printer showing port as LPT1

Image
Image

Example2: Printer showing port as \\PcName\PrinterShareName

Image
[URL=http://g.imageshack.us/img510/

Both the above Dot matrix printers are NETWORK Printers ( not physically connected to my PC's LPT port )

For printers showing port as LPT1 (Example 1) I need to change programatically the port to \\PcName\PrinterShareName ( as the port in Example 2 ).

I am trying to copy a text file to the port shown while selecting a printer

If the port value is \\PcName\PrinterShareName print works fine.

If there is no printer attached to the LPT1 port of my PC and the port value of the network printer is LPT1, then nothing will happen while executing the print command. I know that the other alternative is to map LPT1 thru command prompt NET USE LPT1: \\PcName\PrinterShareName, which I don't prefer.

I am looking for a way to handle it thru FWH

I need this LPT port mapping to be done programatically.

I don't know why some printer are showing LPT1 as port and some showing \\PcName\PrinterShareName

Any help.

Regards

Anser
User avatar
anserkk
 
Posts: 1331
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Postby anserkk » Mon Nov 03, 2008 10:43 am

Hi all,

Just now I found the solution to get certain details of network printers ( dot matrix ) like the name of the PC where the printer is installed and Share name given to the printer.

I find it useful to do raw printing on Dot Matrix printers using copy file \\PcName\PrinterShareName without having to map LPT port

All the required informations are available in the Windows registry itself. I used the class TReg32 to read the informations from the registry.

Regards

Anser
User avatar
anserkk
 
Posts: 1331
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 42 guests