Main Board > Tips and Techniques

How to find the "Location" property of a Windows printer

(1/1)

PxPlus:
For the "location" of a Windows printer you need to read the following registry entry

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print\Printers\<printer name>\Location

Where <printer name> is the name of the printer.

You can use the following logic in your programs to get this value:

 LET OBJ_WINAPI=NEW("*obj/winapi")
 LET REGKEY$="HKEY_LOCAL_MACHINE"
 LET REGSUBKEY$="SOFTWARE\Microsoft\Windows NT\" +
      "CurrentVersion\Print\Printers\"
!
! Add the printer name you got from WINPRT_SETUP LIST
!
 LET REGSUBKEY$+="hp psc 1200 series"
 LET NAME$="Location"
 OBJ_WINAPI'GETREGISTRYVALUE(REGKEY$,REGSUBKEY$,NAME$,VALUE$)
!
 PRINT "Location is:",VALUE$
!
 DROP OBJECT OBJ_WINAPI 

Navigation

[0] Message Index

Go to full version