文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>VC枚举打印机驱动(EnumPrinterDrivers DRIVER_INFO_1)

VC枚举打印机驱动(EnumPrinterDrivers DRIVER_INFO_1)

时间:2010-08-25  来源:妹夫

VC枚举打印机驱动(EnumPrinterDrivers  DRIVER_INFO_1)

 

 1 DRIVER_INFO_1 *pLevel1 = NULL;
2 DWORD dwNeeded = 0,
3 dwReceived = 0,
4 dwError = 0;
5 int nRet = 0;
6
7 nRet = EnumPrinterDrivers(NULL, // local machine
8 NULL, // current environment
9 1, // level 1, whatever that means
10 (LPBYTE) pLevel1,
11 0,
12 &dwNeeded,
13 &dwReceived);
14
15 if (0 == nRet)
16 {
17 dwError = GetLastError();
18
19 }
20
21 pLevel1 = (DRIVER_INFO_1 *) calloc(1, dwNeeded);
22
23 nRet = EnumPrinterDrivers(NULL, // local machine
24 NULL, // current environment
25 1, // level 1, whatever that means
26 (LPBYTE) pLevel1,
27 dwNeeded,
28 &dwNeeded,
29 &dwReceived);
30
31 for (int nCount = 0; nCount < (int) dwReceived; nCount ++)
32 {
33 printf("Name: %s\r\n", pLevel1[nCount].pName);
34 }

代码摘自 http://visual-c.itags.org/visual-c-c++/102968/

相关阅读 更多 +
排行榜 更多 +
幸存者的命运

幸存者的命运

飞行射击 下载
精英战区3d

精英战区3d

飞行射击 下载
货运猎人

货运猎人

飞行射击 下载