LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I retrieve the IP address of the default printer from the windows registry

I am using LabVIEW 7 on windows NT4 computers.
I have a SubVI that I use to ping the network printer to make sure that the printer is on line prior to sending a print at the end of testing a unit.
If LabVIEW does not get a reply to its ping data is saved locally and the user informed.
I would like to modify the VI that pings the printer to ping the default printer of the computer on which the VI is running.
I would be grateful if anyone can show me how to retrieve the default printers IP address.
0 Kudos
Message 1 of 3
(3,501 Views)


Hi Stuart,

The registry entries for User's Default Printer are:

Win 9x:
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Windows]

NT/XP:
[HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows]

"Device"="Printer Name"

The device is the name used to represent the printer in the registry. The name can be found in the [HKEY_CURRENT_USER\Printers\Settings] key.

Machine name is part of the "Printer Name," which you can use to ping directly (i.e., w/out having to look-up its IP address).

Hope this helps.

Regards,

Khalid


0 Kudos
Message 2 of 3
(3,501 Views)
Hello,

Though it may not be exactly what you need, this example program, available on our webpage, shows the use of the registry VIs in LabVIEW. (It's a long link, sorry about that.)

http://sine.ni.com/apps/we/niepd_web_display.display_epd4?p_guid=B45EACE3E76356A4E034080020E74861&p_node=DZ52084&p_source=External

I hope this helps!

Liz Fausak
National Instruments
0 Kudos
Message 3 of 3
(3,501 Views)