WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Printer Controller

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Check if Printer is Shared


Question:

I'm attempting to return a printer attribute on my default printer, specifically if the printer is shared.

Using pGetPrtInfo (12) only returns a number, how do I find out specifically if the PRINTER_ATTRIBUTE_SHARED is true or not?

I could not find any sample code on pGetPrtInfo printer attributes, any help would be appreciated.

AddExtender("WWPRT44I.DLL")
defprtname = pGetDefPrtInf(1)
pshare = pGetPrtInfo("%defprtname%",12)
message("printerShare", pshare)

Answer:

Using the bitwise AND operator ('&'):
AddExtender("WWPRT44I.DLL")
defprtname = pGetDefPrtInf(1)
pshare = pGetPrtInfo(defprtname,12) & 8

Article ID:   W16352
File Created: 2017:07:28:12:58:37
Last Updated: 2005:02:18:11:19:58