Enumerate the printer name

xiaoxiao2021-03-06  99

DWORD DWFLAGS = Printer_enum_favorite | Printer_enum_local;

LPPRINTER_INFO_2 PPRINTERS;

DWORD CBPRINTERS;

DWORD CRETURNED, I;

Enumprinters (dwflags, null, 2, null, 0, & cbprinters, & creturned);

IF (! (pprinters = (lpprinter_info_2) Localalloc (LPTR, CBPrinters 4)))))))

Return False;

IF (! Enumprinters (dwflags, null, 2, (lpbyte) Pprinters,

Cbprinters, & Cbprinters, & Creturned)

{

LocalFree (Pprinters);

Return False;

}

IF (Creturned> 0)

{

For (i = 0; i

{

AfxMessageBox (Pprinters i) -> Pprintername);

IF (strstr (Pprinters i) -> Pprintername, "PDF")! = 0 && Strstr ((Pprinters i) -> Pprintername, "Writer") <= 0)

{

m_snewprinter = "Adobe PDF";

Return True;

}

}

For (i = 0; i

{

IF (strstr (Pprinters i) -> Pprintername, "Acrobat Distiller")! = 0 && m_snewprinter == "") {

m_snewprinter = "acrobat distiller";

Return True;

}

}

}

LocalFree (Pprinters);

Return False;

转载请注明原文地址:https://www.9cbs.com/read-100990.html

New Post(0)