gpt4 book ai didi

c++ - 如何获取打印机类别(类型)?

转载 作者:行者123 更新时间:2023-11-28 02:38:44 34 4
gpt4 key购买 nike

我正在尝试获取可以在打印机属性窗口中看到的打印机类别,例如“传真”或“打印机”。

我发现我可以从 DRIVER_INFO_8 得到它,

DWORD dwNeeded;
LPBYTE lpDriverInfo;
DWORD dwReturned;
DRIVER_INFO_8 *pInfo;
DWORD i;

EnumPrinterDrivers(NULL,
NULL,
8,
NULL,
0,
&dwNeeded,
&dwReturned);

lpDriverInfo = new BYTE[dwNeeded];
if (lpDriverInfo == NULL) {
return NULL;
}

EnumPrinterDrivers(NULL,
NULL,
8,
lpDriverInfo,
dwNeeded,
&dwNeeded,
&dwReturned);

pInfo = (DRIVER_INFO_8 *)lpDriverInfo;

但是 pInfo->dwDriverAttribute 没有显示 PRINTER_DRIVER_CATEGORY_FAX,有在

    cVersion    3   unsigned long
pName 0x0000000000496994 L"Microsoft Shared Fax Driver" wchar_t *
pEnvironment 0x000000000049697c L"Windows x64" wchar_t *
pDriverPath 0x0000000000496916 L"C:\\Windows\\system32\\spool\\DRIVERS\\x64\\3\\FXSDRV.DLL" wchar_t *
pDataFile 0x00000000004968b2 L"C:\\Windows\\system32\\spool\\DRIVERS\\x64\\3\\FXSUI.DLL" wchar_t *
pConfigFile 0x000000000049684e L"C:\\Windows\\system32\\spool\\DRIVERS\\x64\\3\\FXSUI.DLL" wchar_t *
pHelpFile 0x0000000000000000 <NULL> wchar_t *
pDependentFiles 0x0000000000496574 L"C:\\Windows\\system32\\spool\\DRIVERS\\x64\\3\\FXSWZRD.DLL" wchar_t *
pMonitorName 0x0000000000000000 <NULL> wchar_t *
pDefaultDataType 0x0000000000000000 <NULL> wchar_t *
pszzPreviousNames 0x0000000000000000 <NULL> wchar_t *
ftDriverDate {dwLowDateTime=2743894016 dwHighDateTime=29791429 } _FILETIME
dwlDriverVersion 1688854653387882 unsigned __int64
pszMfgName 0x000000000049683a L"Microsoft" wchar_t *
pszOEMUrl 0x0000000000000000 <NULL> wchar_t *
pszHardwareID 0x0000000000496808 L"microsoftmicrosoft_s7d14" wchar_t *
pszProvider 0x00000000004967f4 L"Microsoft" wchar_t *
pszPrintProcessor 0x00000000004967e2 L"winprint" wchar_t *
pszVendorSetup 0x0000000000000000 <NULL> wchar_t *
pszzColorProfiles 0x0000000000000000 <NULL> wchar_t *
pszInfPath 0x0000000000496712 L"C:\\Windows\\System32\\DriverStore\\FileRepository\\prnms002.inf_amd64_neutral_d834e48846616289\\prnms002.inf" wchar_t *
dwPrinterDriverAttributes 1 unsigned long
pszzCoreDriverDependencies 0x0000000000000000 <NULL> wchar_t *
ftMinInboxDriverVerDate {dwLowDateTime=0 dwHighDateTime=0 } _FILETIME
dwlMinInboxDriverVerVersion 0 unsigned __int64

所以我有点困惑 - 如何获得打印机类型?

最佳答案

要获取 PRINTER_DRIVER_CATEGORY_FAX 标志,您至少需要 Windows 8 或 Windows Server 2012 ( http://msdn.microsoft.com/en-us/library/windows/desktop/dd162507(v=vs.85).aspx )。

尝试使用EnumPrintersPRINTER_INFO_2反而。然后您可以测试 PRINTER_ATTRIBUTE_FAX

关于c++ - 如何获取打印机类别(类型)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26673145/

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com